maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r730489 - /maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
Date Wed, 31 Dec 2008 22:14:20 GMT
Author: bentmann
Date: Wed Dec 31 14:14:20 2008
New Revision: 730489

URL: http://svn.apache.org/viewvc?rev=730489&view=rev
Log:
o Improved validation messages

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/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java?rev=730489&r1=730488&r2=730489&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 Dec 31 14:14:20 2008
@@ -189,21 +189,37 @@
 
         File pom = null;
 
-        if ( pomFile != null && pomFile.isFile() )
+        if ( pomFile != null )
         {
-            processModel( readPom( pomFile ) );
+            if ( pomFile.isFile() )
+            {
+                processModel( readPom( pomFile ) );
 
-            pomArtifact = artifactFactory.createArtifact( groupId, artifactId, version, null,
"pom" );
-        }
-        else //if pomFile is not provided check the groupId, artifactId, version and packaging
-        {
-            // Verify arguments
-            if ( groupId == null || artifactId == null || version == null || packaging ==
null )
+                pomArtifact = artifactFactory.createArtifact( groupId, artifactId, version,
null, "pom" );
+            }
+            else
             {
-                throw new MojoExecutionException( "Missing group, artifact, version, or packaging
information" );
+                getLog().warn( "Ignored non-existent POM file " + pomFile );
             }
         }
 
+        if ( StringUtils.isEmpty( groupId ) )
+        {
+            throw new MojoExecutionException( "Missing group identifier, please specify -DgroupId=..."
);
+        }
+        if ( StringUtils.isEmpty( artifactId ) )
+        {
+            throw new MojoExecutionException( "Missing artifact identifier, please specify
-DartifactId=..." );
+        }
+        if ( StringUtils.isEmpty( version ) )
+        {
+            throw new MojoExecutionException( "Missing version, please specify -Dversion=..."
);
+        }
+        if ( StringUtils.isEmpty( packaging ) )
+        {
+            throw new MojoExecutionException( "Missing packaging type, please specify -Dpackaging=..."
);
+        }
+
         Artifact artifact =
             artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, packaging,
classifier );
 
@@ -225,7 +241,6 @@
                 model.setDescription( "POM was created from install:install-file" );
 
                 fw = WriterFactory.newXmlWriter( tempFile );
-                tempFile.deleteOnExit();
                 new MavenXpp3Writer().write( fw, model );
                 metadata = new ProjectArtifactMetadata( artifact, tempFile );
                 artifact.addMetadata( metadata );
@@ -248,7 +263,7 @@
 
             File destination = new File( localRepository.getBasedir(), localPath );
 
-            if ( !file.getPath().equals( destination.getPath() ) )
+            if ( !file.equals( destination ) )
             {
                 installer.install( file, artifact, localRepository );
 
@@ -265,7 +280,7 @@
                     installCheckSum( file, artifact, false );
                 }
 
-                if ( pomFile != null && pomFile.exists() )
+                if ( pomFile != null && pomFile.isFile() )
                 {
                     installer.install( pomFile, pomArtifact, localRepository );
 



Mime
View raw message