You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/12/20 09:33:49 UTC

[maven-ear-plugin] 32/45: PR: MNG-1025 use standard resources for the ear plugin

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

hboutemy pushed a commit to annotated tag maven-ear-plugin-2.0
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git

commit 353c13f9ffd74cb634aad255d381455b1c3e82bc
Author: Brett Leslie Porter <br...@apache.org>
AuthorDate: Mon Oct 3 02:30:06 2005 +0000

    PR: MNG-1025
    use standard resources for the ear plugin
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk/maven-plugins/maven-ear-plugin@293212 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/maven/plugin/ear/AbstractEarMojo.java   | 15 ++-----------
 .../java/org/apache/maven/plugin/ear/EarMojo.java  | 25 +++++++++++-----------
 .../plugin/ear/GenerateApplicationXmlMojo.java     |  2 +-
 3 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java b/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
index 687b3d3..eaea6e2 100644
--- a/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
+++ b/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
@@ -61,14 +61,12 @@ public abstract class AbstractEarMojo
      * @parameter expression="${project.build.directory}/${project.build.finalName}"
      * @required
      */
-    private String workDirectory;
+    private File workDirectory;
 
     private List earModules;
 
     private List allModules;
 
-    private File buildDir;
-
     public void execute()
         throws MojoExecutionException
     {
@@ -138,21 +136,12 @@ public abstract class AbstractEarMojo
         return earModules;
     }
 
-    protected File getBuildDir()
-    {
-        if ( buildDir == null )
-        {
-            buildDir = new File( workDirectory );
-        }
-        return buildDir;
-    }
-
     protected MavenProject getProject()
     {
         return project;
     }
 
-    protected String getWorkDirectory()
+    protected File getWorkDirectory()
     {
         return workDirectory;
     }
diff --git a/src/main/java/org/apache/maven/plugin/ear/EarMojo.java b/src/main/java/org/apache/maven/plugin/ear/EarMojo.java
index de419fc..caeaebc 100644
--- a/src/main/java/org/apache/maven/plugin/ear/EarMojo.java
+++ b/src/main/java/org/apache/maven/plugin/ear/EarMojo.java
@@ -76,14 +76,15 @@ public class EarMojo
      * @readonly
      */
     private String finalName;
-    
+
     /**
-     * Directory that resources are copied to during the build.
+     * The directory to get the resources from.
      *
-     * @parameter expression="${project.build.directory}/ear"
+     * @parameter expression="${project.build.outputDirectory}"
+     * @required
      */
     private File resourcesDir;
-    
+
     /**
      * The maven archiver to use.
      *
@@ -113,7 +114,7 @@ public class EarMojo
             {
                 EarModule module = (EarModule) iter.next();
                 getLog().info( "Copying artifact[" + module + "] to[" + module.getUri() + "]" );
-                File destinationFile = buildDestinationFile( getBuildDir(), module.getUri() );
+                File destinationFile = buildDestinationFile( getWorkDirectory(), module.getUri() );
 
                 File sourceFile = module.getArtifact().getFile();
 
@@ -137,8 +138,8 @@ public class EarMojo
             File earSourceDir = new File( earSourceDirectory );
             if ( earSourceDir.exists() )
             {
-                getLog().info( "Copy ear sources to " + getBuildDir().getAbsolutePath() );
-                FileUtils.copyDirectoryStructure( earSourceDir, getBuildDir() );
+                getLog().info( "Copy ear sources to " + getWorkDirectory().getAbsolutePath() );
+                FileUtils.copyDirectoryStructure( earSourceDir, getWorkDirectory() );
             }
         }
         catch ( IOException e )
@@ -151,8 +152,8 @@ public class EarMojo
         {
             if ( resourcesDir.exists() )
             {
-                getLog().info( "Copy ear resources to " + getBuildDir().getAbsolutePath() );
-                FileUtils.copyDirectoryStructure( resourcesDir, getBuildDir() );
+                getLog().info( "Copy ear resources to " + getWorkDirectory().getAbsolutePath() );
+                FileUtils.copyDirectoryStructure( resourcesDir, getWorkDirectory() );
             }
         }
         catch ( IOException e )
@@ -161,7 +162,7 @@ public class EarMojo
         }
 
         // Check if deployment descriptor is there
-        File ddFile = new File( getBuildDir(), APPLICATION_XML_URI );
+        File ddFile = new File( getWorkDirectory(), APPLICATION_XML_URI );
         if ( !ddFile.exists() )
         {
             throw new MojoExecutionException(
@@ -177,7 +178,7 @@ public class EarMojo
             // Include custom manifest if necessary
             includeCustomManifestFile();
 
-            archiver.getArchiver().addDirectory( getBuildDir() );
+            archiver.getArchiver().addDirectory( getWorkDirectory() );
             archiver.createArchive( getProject(), archive );
 
             project.getArtifact().setFile( earFile );
@@ -198,7 +199,7 @@ public class EarMojo
         File customManifestFile = new File( manifestFile );
         if ( !customManifestFile.exists() )
         {
-            getLog().info( "Could not find manifest file: " + manifestFile +" - Generating one");
+            getLog().info( "Could not find manifest file: " + manifestFile + " - Generating one" );
         }
         else
         {
diff --git a/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java b/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java
index c1ebd2d..4a3501d 100644
--- a/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java
+++ b/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java
@@ -120,7 +120,7 @@ public class GenerateApplicationXmlMojo
             getLog().info( "Generating application.xml" );
             generateDeploymentDescriptor();
             FileUtils.copyFileToDirectory( new File( generatedDescriptorLocation, "application.xml" ),
-                                           new File( getBuildDir(), "META-INF" ) );
+                                           new File( getWorkDirectory(), "META-INF" ) );
         }
         catch ( IOException e )
         {

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.