maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khmarba...@apache.org
Subject svn commit: r1728841 - /maven/plugins/trunk/maven-rar-plugin/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
Date Sat, 06 Feb 2016 14:26:57 GMT
Author: khmarbaise
Date: Sat Feb  6 14:26:56 2016
New Revision: 1728841

URL: http://svn.apache.org/viewvc?rev=1728841&view=rev
Log:
o Removed literal assignment of a default value
  for a plugin parameter which is already set by
  injection.
o Removed debug output of configuration.
o Refactored code a little bit.

Modified:
    maven/plugins/trunk/maven-rar-plugin/src/main/java/org/apache/maven/plugins/rar/RarMojo.java

Modified: maven/plugins/trunk/maven-rar-plugin/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-rar-plugin/src/main/java/org/apache/maven/plugins/rar/RarMojo.java?rev=1728841&r1=1728840&r2=1728841&view=diff
==============================================================================
--- maven/plugins/trunk/maven-rar-plugin/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
(original)
+++ maven/plugins/trunk/maven-rar-plugin/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
Sat Feb  6 14:26:56 2016
@@ -254,7 +254,7 @@ public class RarMojo
      * @since 2.3
      */
     @Parameter( property = "warnOnMissingRaXml", defaultValue = "true" )
-    protected boolean warnOnMissingRaXml = true;
+    protected boolean warnOnMissingRaXml;
 
     /**
      * To skip execution of the rar mojo.
@@ -301,15 +301,6 @@ public class RarMojo
             return;
         }
 
-        getLog().debug( " ======= RarMojo settings =======" );
-        getLog().debug( "rarSourceDirectory[" + rarSourceDirectory + "]" );
-        getLog().debug( "manifestFile[" + manifestFile + "]" );
-        getLog().debug( "raXmlFile[" + raXmlFile + "]" );
-        getLog().debug( "workDirectory[" + workDirectory + "]" );
-        getLog().debug( "outputDirectory[" + outputDirectory + "]" );
-        getLog().debug( "finalName[" + finalName + "]" );
-        getLog().debug( "classifier[" + classifier + "]" );
-
         // Check if jar file is there and if requested, copy it
         try
         {
@@ -350,6 +341,56 @@ public class RarMojo
             throw new MojoExecutionException( "Error copying RAR dependencies", e );
         }
 
+        resourceHandling();
+
+        // Include custom manifest if necessary
+        try
+        {
+            includeCustomRaXmlFile();
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Error copying ra.xml file", e );
+        }
+
+        // Check if connector deployment descriptor is there
+        File ddFile = new File( getBuildDir(), RA_XML_URI );
+        if ( !ddFile.exists() && warnOnMissingRaXml )
+        {
+            getLog().warn( "Connector deployment descriptor: " + ddFile.getAbsolutePath()
+ " does not exist." );
+        }
+
+        File rarFile = getRarFile( outputDirectory, finalName, classifier );
+        try
+        {
+            MavenArchiver archiver = new MavenArchiver();
+            archiver.setArchiver( jarArchiver );
+            archiver.setOutputFile( rarFile );
+
+            // Include custom manifest if necessary
+            includeCustomManifestFile();
+
+            archiver.getArchiver().addDirectory( getBuildDir() );
+            archiver.createArchive( session, project, archive );
+        }
+        catch ( Exception e )
+        {
+            throw new MojoExecutionException( "Error assembling RAR", e );
+        }
+
+        if ( classifier != null )
+        {
+            projectHelper.attachArtifact( project, "rar", classifier, rarFile );
+        }
+        else
+        {
+            project.getArtifact().setFile( rarFile );
+        }
+    }
+
+    private void resourceHandling()
+        throws MojoExecutionException
+    {
         Resource resource = new Resource();
         resource.setDirectory( rarSourceDirectory.getAbsolutePath() );
         resource.setTargetPath( getBuildDir().getAbsolutePath() );
@@ -416,50 +457,6 @@ public class RarMojo
         {
             throw new MojoExecutionException( "Error copying RAR resources", e );
         }
-
-        // Include custom manifest if necessary
-        try
-        {
-            includeCustomRaXmlFile();
-        }
-        catch ( IOException e )
-        {
-            throw new MojoExecutionException( "Error copying ra.xml file", e );
-        }
-
-        // Check if connector deployment descriptor is there
-        File ddFile = new File( getBuildDir(), RA_XML_URI );
-        if ( !ddFile.exists() && warnOnMissingRaXml )
-        {
-            getLog().warn( "Connector deployment descriptor: " + ddFile.getAbsolutePath()
+ " does not exist." );
-        }
-
-        File rarFile = getRarFile( outputDirectory, finalName, classifier );
-        try
-        {
-            MavenArchiver archiver = new MavenArchiver();
-            archiver.setArchiver( jarArchiver );
-            archiver.setOutputFile( rarFile );
-
-            // Include custom manifest if necessary
-            includeCustomManifestFile();
-
-            archiver.getArchiver().addDirectory( getBuildDir() );
-            archiver.createArchive( session, project, archive );
-        }
-        catch ( Exception e )
-        {
-            throw new MojoExecutionException( "Error assembling RAR", e );
-        }
-
-        if ( classifier != null )
-        {
-            projectHelper.attachArtifact( project, "rar", classifier, rarFile );
-        }
-        else
-        {
-            project.getArtifact().setFile( rarFile );
-        }
     }
 
     protected File getBuildDir()



Mime
View raw message