You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2019/03/16 09:24:35 UTC

[maven-rar-plugin] 01/01: Code improvements.

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch CODE_IMPROVEMENTS
in repository https://gitbox.apache.org/repos/asf/maven-rar-plugin.git

commit 50d0dc7edb701338464cfdf7a7dafa237d8f55f3
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Jul 8 16:55:42 2018 +0200

    Code improvements.
---
 .../java/org/apache/maven/plugins/rar/RarMojo.java | 46 ++++++++++++----------
 1 file changed, 26 insertions(+), 20 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/rar/RarMojo.java b/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
index cc98d28..70efdf3 100644
--- a/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/rar/RarMojo.java
@@ -324,26 +324,7 @@ public class RarMojo
         }
 
         // Copy dependencies
-        try
-        {
-            Set<Artifact> artifacts = project.getArtifacts();
-            for ( Artifact artifact : artifacts )
-            {
-
-                ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
-                if ( !artifact.isOptional() && filter.include( artifact )
-                    && artifact.getArtifactHandler().isAddedToClasspath() )
-                {
-                    getLog().info( "Copying artifact[" + artifact.getGroupId() + ", " + artifact.getId() + ", "
-                                       + artifact.getScope() + "]" );
-                    FileUtils.copyFileToDirectory( artifact.getFile(), getBuildDir() );
-                }
-            }
-        }
-        catch ( IOException e )
-        {
-            throw new MojoExecutionException( "Error copying RAR dependencies", e );
-        }
+        copyDependencies();
 
         resourceHandling();
 
@@ -392,6 +373,31 @@ public class RarMojo
         }
     }
 
+    private void copyDependencies()
+        throws MojoExecutionException
+    {
+        try
+        {
+            Set<Artifact> artifacts = project.getArtifacts();
+            for ( Artifact artifact : artifacts )
+            {
+
+                ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
+                if ( !artifact.isOptional() && filter.include( artifact )
+                    && artifact.getArtifactHandler().isAddedToClasspath() )
+                {
+                    getLog().info( "Copying artifact[" + artifact.getGroupId() + ", " + artifact.getId() + ", "
+                                       + artifact.getScope() + "]" );
+                    FileUtils.copyFileToDirectory( artifact.getFile(), getBuildDir() );
+                }
+            }
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Error copying RAR dependencies", e );
+        }
+    }
+
     private void resourceHandling()
         throws MojoExecutionException
     {