Author: aramirez
Date: Wed Nov 23 01:21:02 2005
New Revision: 348401

URL: http://svn.apache.org/viewcvs?rev=348401&view=rev
Log:
-added pomFile parameter to make install-file install the jar and the customed 
pom at the same time.

Modified:
    
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java

Modified: 
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java?rev=348401&r1=348400&r2=348401&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
 Wed Nov 23 01:21:02 2005
@@ -77,6 +77,11 @@
      * @readonly
      */
     private File file;
+    
+    /**
+     * @parameter expression="${pomFile}"
+     */
+    private File pomFile;
 
     /**
      * @parameter expression="${generatePom}"
@@ -96,6 +101,13 @@
     {
         Artifact artifact = artifactFactory.createArtifact( groupId, 
artifactId, version, null, packaging );
 
+        Artifact pomArtifact = null;
+        
+        if( pomFile != null && pomFile.exists() )
+        {
+               pomArtifact = artifactFactory.createArtifact( groupId, 
artifactId, version, null, "pom" );
+        }
+        
         // TODO: check if it exists first, and default to true if not
         if ( generatePom )
         {
@@ -139,7 +151,12 @@
             if( !file.getPath().equals( destination.getPath() ) )
             {
                 installer.install( file, artifact, localRepository );
-            }
+                
+                if( pomFile != null && pomFile.exists() )
+                {
+                       installer.install( pomFile, pomArtifact, 
localRepository );
+                }
+            } 
             else
             {
                 throw new MojoFailureException( "Cannot install artifact. 
Artifact is already in the local repository.\n\nFile in question is: " + file + 
"\n" );


Reply via email to