Author: mperham
Date: Sat Jul 8 13:02:46 2006
New Revision: 420184
URL: http://svn.apache.org/viewvc?rev=420184&view=rev
Log:
PR: MINSTALL-24, MINSTALL-27
Add classifier support so you can install sources, javadoc, etc
Documentation revision to clean up verbage, add site.xml, etc
Added:
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/custom-pom-installation.apt
- copied, changed from r420179,
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/customed-pom-installation.apt
maven/plugins/trunk/maven-install-plugin/src/site/site.xml (with props)
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/install-file-with-classifier/
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/install-file-with-classifier/plugin-config.xml
(with props)
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/install-file-with-classifier/target/
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/install-file-with-classifier/target/maven-install-test-1.0-SNAPSHOT.jar
Removed:
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/customed-pom-installation.apt
Modified:
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/generic-pom-generation.apt
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/installingChecksums.apt
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/updateReleaseInfo.apt
maven/plugins/trunk/maven-install-plugin/src/site/apt/index.apt
maven/plugins/trunk/maven-install-plugin/src/site/apt/usage.apt
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
Modified:
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java?rev=420184&r1=420183&r2=420184&view=diff
==============================================================================
---
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
(original)
+++
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
Sat Jul 8 13:02:46 2006
@@ -78,6 +78,14 @@
protected String packaging;
/**
+ * Classifier type of the artifact to be installed. For example,
"sources" or "javadoc".
+ * Defaults to none which means this is the project's main jar.
+ *
+ * @parameter expression="${classifier}"
+ */
+ protected String classifier;
+
+ /**
* The file to be deployed
*
* @parameter expression="${file}"
@@ -130,7 +138,8 @@
}
}
- Artifact artifact = artifactFactory.createArtifact( groupId,
artifactId, version, null, packaging );
+ Artifact artifact = artifactFactory.createArtifactWithClassifier(
+ groupId, artifactId, version, packaging, classifier );
// TODO: check if it exists first, and default to true if not
if ( generatePom )
Copied:
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/custom-pom-installation.apt
(from r420179,
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/customed-pom-installation.apt)
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/custom-pom-installation.apt?p2=maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/custom-pom-installation.apt&p1=maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/customed-pom-installation.apt&r1=420179&r2=420184&rev=420184&view=diff
==============================================================================
---
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/customed-pom-installation.apt
(original)
+++
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/custom-pom-installation.apt
Sat Jul 8 13:02:46 2006
@@ -1,17 +1,16 @@
----
- Maven 2 Install Plugin - Installing artifact with a customed Pom
+ Maven 2 Install Plugin - Installing an artifact with a customized POM
------
Allan Ramirez
------
June 2006
------
-Install an artifact with a customed POM
+Install an artifact with a custom POM
- The install plugin also has a feature that allows a pom to be included
- during the installation of a 3rd party artifact. This can be done by
- setting the value of the <<pomFile>> parameter to the path of the
- customed POM.
+ The install plugin can include a pre-built custom POM with the artifact
+ in the local repository. Just set the value of the <<pomFile>> parameter
+ to the path of the custom POM.
+---+
mvn install:install-file -Dfile=path-to-your-artifact-jar \
@@ -20,4 +19,4 @@
-Dversion=version \
-Dpackaging=jar \
-DpomFile=path-to-pom
-+---+
\ No newline at end of file
++---+
Modified:
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/generic-pom-generation.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/generic-pom-generation.apt?rev=420184&r1=420183&r2=420184&view=diff
==============================================================================
---
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/generic-pom-generation.apt
(original)
+++
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/generic-pom-generation.apt
Sat Jul 8 13:02:46 2006
@@ -1,5 +1,5 @@
----
- Maven 2 Install Plugin - Generic Pom Generation
+ Maven 2 Install Plugin - Generic POM Generation
------
Allan Ramirez
------
@@ -8,12 +8,12 @@
Generate a generic POM
- By default there is no pom included in installing a 3rd party artifact.
- Although the user may specify the pom but there are still times that the
- artifact doesn't have poms such as the SUN jars. The install plugin has
- the capability of creating a generic POM for this kind of artifacts which
- contains minimum pom elements such as groupId, artifactId, version,
packaging.
- It can be activated by setting the <<generatePom>> parameter to <<true>>.
+ There are times when you do not have a POM for a 3rd party artifact.
+ For instance, when installing a proprietary or commercial JAR into a
repository.
+ The install plugin can create a generic POM in this case which
+ contains the minimal set of POM elements required by Maven, such as groupId,
+ artifactId, version, packaging. You tell Maven to generate a POM by setting
the
+ <<generatePom>> parameter to <<true>>.
+---+
mvn install:install-file -Dfile=path-to-your-artifact-jar \
@@ -22,4 +22,4 @@
-Dversion=version \
-Dpackaging=jar \
-DgeneratePom=true
-+---+
\ No newline at end of file
++---+
Modified:
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/installingChecksums.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/installingChecksums.apt?rev=420184&r1=420183&r2=420184&view=diff
==============================================================================
---
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/installingChecksums.apt
(original)
+++
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/installingChecksums.apt
Sat Jul 8 13:02:46 2006
@@ -8,19 +8,19 @@
Creating artifact checksums
- The install plugin has the feature of creating the checksums(MD5, SHA-1)
- of the artifacts during installation. Checksums are cryptographic hash
- functions used for checking the integrity of the files. This can be
+ The install plugin can create integrity checksums (MD5, SHA-1)
+ for the artifacts during installation. Checksums are cryptographic hash
+ functions and are used to check the integrity of the associated file. This
can be
activated by setting the <<createChecksum>> parameter to <<true>>.
- In <<<install:install>>> mojo.
+ In the <<<install:install>>> mojo.
+---+
mvn install -DcreateChecksum=true
+---+
- Can also be done in <<<install:install-file>>> goal.
+ In the <<<install:install-file>>> goal.
+---+
mvn install:install-file -Dfile=path-to-your-artifact-jar \
Modified:
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/updateReleaseInfo.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/updateReleaseInfo.apt?rev=420184&r1=420183&r2=420184&view=diff
==============================================================================
---
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/updateReleaseInfo.apt
(original)
+++
maven/plugins/trunk/maven-install-plugin/src/site/apt/examples/updateReleaseInfo.apt
Sat Jul 8 13:02:46 2006
@@ -8,5 +8,4 @@
Update the release information of a project
-
-
+ TODO
Modified: maven/plugins/trunk/maven-install-plugin/src/site/apt/index.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/site/apt/index.apt?rev=420184&r1=420183&r2=420184&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/site/apt/index.apt (original)
+++ maven/plugins/trunk/maven-install-plugin/src/site/apt/index.apt Sat Jul 8
13:02:46 2006
@@ -8,29 +8,28 @@
Maven 2 Install Plugin - Introduction
- Local Repository is the local cached of a remote repository where
- all artifacts needed for the build are stored. By default, it is located at
- the user home directory (~/.m2/repository) and can be configured in the
- <<<settings.xml>>> at \<localRepository\> element.
-
- The install plugin is used during the install phase, to place or add the
- artifact(s) to the local repository correctly. The install plugin uses
- the information in the POM(groupId, artifactId, version) to determine
- the installation path of the artifact in order for maven to picked
- it up correctly.
+ The Local Repository is the local cache where
+ all artifacts needed for the build are stored. By default, it is located
within
+ the user's home directory (~/.m2/repository) but the location can be
configured in
+ <<<~/.m2/settings.xml>>> using the \<localRepository\> element.
+
+ The install plugin is used during the install phase to add
+ artifact(s) to the local repository. The install plugin uses
+ the information in the POM (groupId, artifactId, version) to determine
+ the proper location for the artifact within the local repository.
* Goals Overview
The install plugin has 2 goals:
- * {{{index.html}install:install}} is used to automatically install the
- artifact in the local repository, its pom and the attached artifacts
- produced by a particular project.
-
- * {{{index.html}install:install-file}} is mostly used to install a single
- or 3rd party artifact along with its pom. In that case the artifact
- information can be taken from an optionally specified pomFile, but can
- be completed/overriden using the command line.
+ * {{{install-mojo.html}install:install}} is used to automatically install the
+ main project artifact (the jar, war or ear), its pom and any attached
artifacts
+ (sources, javadoc, etc) produced by a particular project.
+
+ * {{{install-file-mojo.html}install:install-file}} is mostly used to install
an externally
+ created artifact into the local repository, along with its pom. In that
case
+ the project information can be taken from an optionally specified
pomFile, but can
+ be given using command line parameters.
* Usage
@@ -39,4 +38,4 @@
* Examples
- Sample use-cases for the plugin are available under the Examples menu
\ No newline at end of file
+ Sample use-cases for the plugin are available under the Examples menu.
Modified: maven/plugins/trunk/maven-install-plugin/src/site/apt/usage.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/site/apt/usage.apt?rev=420184&r1=420183&r2=420184&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/site/apt/usage.apt (original)
+++ maven/plugins/trunk/maven-install-plugin/src/site/apt/usage.apt Sat Jul 8
13:02:46 2006
@@ -10,9 +10,9 @@
* The <<<install:install>>> Mojo
- In most cases, install:install goal doesnt need any configurations, it
- needs the project's POM(where information are retrieved) and its artifact
file
- then invoked the <<<install>>> phase of the default build lifecycle.
+ In most cases, install:install goal doesnt need any configuration, it
+ needs the project's POM and the artifact file to be installed during the
+ <<<install>>> phase of the default build lifecycle.
+---+
mvn install
@@ -21,9 +21,9 @@
* The <<<install:install-file>>> Mojo
The <<<install:install-file>>> mojo is used primarily for installing
artifacts to
- which were not built by Maven. The project's development team may or may not
- provide a POM for the artifact. The full usage statement of the install-file
- mojo can be described as:
+ the local repository which were not built by Maven. The project's
development team
+ may or may not provide a POM for the artifact. Here's a complete example of
the
+ install-file mojo:
+---+
mvn install:install-file -Dfile=your-artifact-1.0.jar \
@@ -32,6 +32,7 @@
[-DartifactId=your-artifact] \
[-Dversion=1.0] \
[-Dpackaging=jar] \
+ [-Dclassifier=sources] \
[-DgeneratePom=true]
[-DcreateChecksum=true]
+---+
@@ -42,4 +43,7 @@
groupId can be considered if the groupId is not specified further for the
current project or on the command line.
+ * the classifier parameter can be used to install secondary artifacts for a
project,
+ like a javadoc or sources jar. If not given, Maven assumes the file is
the main
+ artifact for the project.
Added: maven/plugins/trunk/maven-install-plugin/src/site/site.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/site/site.xml?rev=420184&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/site/site.xml (added)
+++ maven/plugins/trunk/maven-install-plugin/src/site/site.xml Sat Jul 8
13:02:46 2006
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project name="Maven PMD Plugin">
+ <bannerLeft>
+ <name>Maven Install Plugin</name>
+ <src>http://maven.apache.org/images/apache-maven-project.png</src>
+ <href>http://maven.apache.org/</href>
+ </bannerLeft>
+ <bannerRight>
+ <src>http://maven.apache.org/images/maven-small.gif</src>
+ </bannerRight>
+ <body>
+ <links>
+ <item name="Maven 2" href="http://maven.apache.org/maven2/"/>
+ </links>
+
+ <menu name="Overview">
+ <item name="Overview" href="index.html"/>
+ <item name="Usage" href="usage.html"/>
+ <item name="FAQ" href="faq.html"/>
+ </menu>
+
+ <menu name="Examples">
+ <item name="Custom POM" href="examples/custom-pom-installation.html"/>
+ <item name="Generic POM" href="examples/generic-pom-generation.html"/>
+ <item name="Installing Checksums"
href="examples/installingChecksums.html"/>
+ <item name="Updating Release Info"
href="examples/updateReleaseInfo.html"/>
+ </menu>
+ ${reports}
+ </body>
+</project>
Propchange: maven/plugins/trunk/maven-install-plugin/src/site/site.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java?rev=420184&r1=420183&r2=420184&view=diff
==============================================================================
---
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
(original)
+++
maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
Sat Jul 8 13:02:46 2006
@@ -43,6 +43,8 @@
private String packaging;
+ private String classifier;
+
private File file;
private final String LOCAL_REPO = "target/local-repo/";
@@ -88,6 +90,30 @@
assertTrue( installedArtifact.exists() );
}
+ public void testInstallFileWithClassifier()
+ throws Exception
+ {
+ File testPom = new File( getBasedir(),
+
"target/test-classes/unit/install-file-with-classifier/plugin-config.xml" );
+
+ InstallFileMojo mojo = ( InstallFileMojo ) lookupMojo( "install-file",
testPom );
+
+ assertNotNull( mojo );
+
+ assignValuesForParameter( mojo );
+
+ assertNotNull( classifier );
+
+ mojo.execute();
+
+ File installedArtifact = new File( getBasedir(), LOCAL_REPO +
+ groupId + "/" + artifactId + "/" +
+ version + "/" + artifactId + "-" +
+ version + "-" + classifier + "." +
packaging );
+
+ assertTrue( installedArtifact.exists() );
+ }
+
public void testInstallFileWithGeneratePom()
throws Exception
{
@@ -245,6 +271,8 @@
this.packaging = ( String ) getVariableValueFromObject( obj,
"packaging" );
+ this.classifier = ( String ) getVariableValueFromObject( obj,
"classifier" );
+
this.file = ( File ) getVariableValueFromObject( obj, "file" );
}
Added:
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/install-file-with-classifier/plugin-config.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/install-file-with-classifier/plugin-config.xml?rev=420184&view=auto
==============================================================================
---
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/install-file-with-classifier/plugin-config.xml
(added)
+++
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/install-file-with-classifier/plugin-config.xml
Sat Jul 8 13:02:46 2006
@@ -0,0 +1,18 @@
+<project>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>maven-install-file-test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <classifier>sources</classifier>
+
<file>${basedir}/src/test/resources/unit/install-file-with-classifier/target/maven-install-test-1.0-SNAPSHOT.jar</file>
+ <localRepository>${localRepository}</localRepository>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange:
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/install-file-with-classifier/plugin-config.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/install-file-with-classifier/target/maven-install-test-1.0-SNAPSHOT.jar
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/resources/unit/install-file-with-classifier/target/maven-install-test-1.0-SNAPSHOT.jar?rev=420184&view=auto
==============================================================================
Binary files /tmp/tmp81ephk and /tmp/tmpEPwK1q differ