incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r916856 - in /incubator/aries/trunk/application/eba-maven-plugin/src: main/java/org/apache/aries/plugin/eba/EbaMojo.java test/java/org/apache/aries/plugin/eba/EbaMojoTest.java
Date Fri, 26 Feb 2010 23:19:19 GMT
Author: djencks
Date: Fri Feb 26 23:19:19 2010
New Revision: 916856

URL: http://svn.apache.org/viewvc?rev=916856&view=rev
Log:
ARIES-120 don't copy jars twice

Modified:
    incubator/aries/trunk/application/eba-maven-plugin/src/main/java/org/apache/aries/plugin/eba/EbaMojo.java
    incubator/aries/trunk/application/eba-maven-plugin/src/test/java/org/apache/aries/plugin/eba/EbaMojoTest.java

Modified: incubator/aries/trunk/application/eba-maven-plugin/src/main/java/org/apache/aries/plugin/eba/EbaMojo.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/eba-maven-plugin/src/main/java/org/apache/aries/plugin/eba/EbaMojo.java?rev=916856&r1=916855&r2=916856&view=diff
==============================================================================
--- incubator/aries/trunk/application/eba-maven-plugin/src/main/java/org/apache/aries/plugin/eba/EbaMojo.java
(original)
+++ incubator/aries/trunk/application/eba-maven-plugin/src/main/java/org/apache/aries/plugin/eba/EbaMojo.java
Fri Feb 26 23:19:19 2010
@@ -25,6 +25,7 @@
 import org.apache.maven.archiver.MavenArchiveConfiguration;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.artifact.Artifact;
+import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.DirectoryScanner;
@@ -158,13 +159,14 @@
                 File generatedJarFile = new File( outputDirectory, finalName + ".jar" );
                 if (generatedJarFile.exists()) {
                     getLog().info( "Including generated jar file["+generatedJarFile.getName()+"]");
-                    FileUtils.copyFileToDirectory( generatedJarFile, getBuildDir());
+                    jarArchiver.addFile(generatedJarFile, finalName + ".jar");
                 }
             }
         }
-        catch ( IOException e )
+        catch ( ArchiverException e )
         {
-            throw new MojoExecutionException( "Error copying generated Jar file", e );
+            throw new MojoExecutionException( "Error adding generated Jar file", e );
+
         }
 
         // Copy dependencies
@@ -180,11 +182,11 @@
                 {
                     getLog().info("Copying artifact[" + artifact.getGroupId() + ", " + artifact.getId()
+ ", " +
                         artifact.getScope() + "]");
-                    FileUtils.copyFileToDirectory( artifact.getFile(), getBuildDir() );
+                    jarArchiver.addFile(artifact.getFile(), artifact.getArtifactId() + "-"
+ artifact.getVersion() + "." + (artifact.getType() == null? "jar": artifact.getType()));
                 }
             }
         }
-        catch ( IOException e )
+        catch ( ArchiverException e )
         {
             throw new MojoExecutionException( "Error copying EBA dependencies", e );
         }
@@ -256,7 +258,10 @@
             // Include custom manifest if necessary
             includeCustomManifestFile();
 
-            jarArchiver.addDirectory( getBuildDir() );
+            File buildDir = getBuildDir();
+            if (buildDir.isDirectory()) {
+                jarArchiver.addDirectory(buildDir);
+            }
             //include legal files if any
             File sharedResourcesDir = new File(sharedResources);
             if (sharedResourcesDir.isDirectory()) {

Modified: incubator/aries/trunk/application/eba-maven-plugin/src/test/java/org/apache/aries/plugin/eba/EbaMojoTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/eba-maven-plugin/src/test/java/org/apache/aries/plugin/eba/EbaMojoTest.java?rev=916856&r1=916855&r2=916856&view=diff
==============================================================================
--- incubator/aries/trunk/application/eba-maven-plugin/src/test/java/org/apache/aries/plugin/eba/EbaMojoTest.java
(original)
+++ incubator/aries/trunk/application/eba-maven-plugin/src/test/java/org/apache/aries/plugin/eba/EbaMojoTest.java
Fri Feb 26 23:19:19 2010
@@ -74,50 +74,13 @@
 
         mojo.execute();
 
-        //check the working directory
-        File workDirectory = new File( workDir );
-
-        assertTrue( workDirectory.exists() );
-
-        assertTrue( workDirectory.isDirectory() );
-
-        File[] fileNames = workDirectory.listFiles();
-
-        List expectedFiles = new ArrayList();
-        
-        expectedFiles.add( "maven-artifact01-1.0-SNAPSHOT.jar" );
-        expectedFiles.add( "maven-artifact02-1.0-SNAPSHOT.jar" );
-        expectedFiles.add( "test-eba.jar" );
-        
-        assertEquals( "Files in working directory", expectedFiles.size(), fileNames.length
);
-
-        
-        for( int i=0; i<fileNames.length; i++ )
-        {
-            String fileName = fileNames[i].getName();
-            
-            assertTrue( expectedFiles.contains( fileName ) );
-            
-            if( expectedFiles.contains( fileName ) )
-            {
-                expectedFiles.remove( fileName );
-                assertFalse( expectedFiles.contains( fileName ) );
-            }
-            else
-            {
-                fail( fileName + " is not included in expected files." );
-            }
-        }
-
-        assertEquals( 0, expectedFiles.size() );
-
         //check the generated eba file
         File ebaFile = new File( outputDir, finalName + ".eba" );
 
         assertTrue( ebaFile.exists() );
 
         //expected files/directories inside the eba file
-        expectedFiles = new ArrayList();
+        List expectedFiles = new ArrayList();
 
         expectedFiles.add( "META-INF/maven/org.apache.maven.test/maven-eba-test/pom.properties"
);
         expectedFiles.add( "META-INF/maven/org.apache.maven.test/maven-eba-test/pom.xml"
);
@@ -157,39 +120,13 @@
 
         mojo.execute();
 
-        //check the working directory
-        File workDirectory = new File( workDir );
-
-        assertTrue( workDirectory.exists() );
-
-        assertTrue( workDirectory.isDirectory() );
-
-        File[] fileNames = workDirectory.listFiles();
-
-        List expectedFiles = new ArrayList();
-        List fileList = new ArrayList();
-
-        for( int i=0; i<fileNames.length; i++ )
-        {
-            addFileToList( fileNames[i], fileList );
-        }
-
-        expectedFiles.add( "application.mf" );
-        expectedFiles.add( "maven-artifact01-1.0-SNAPSHOT.jar" );
-        expectedFiles.add( "maven-artifact02-1.0-SNAPSHOT.jar" );
-        expectedFiles.add( "META-INF" );
-
-        assertEquals( expectedFiles.size(), fileList.size() );
-
-        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );
-
         //check the generated eba file
         File ebaFile = new File( outputDir, finalName + ".eba" );
 
         assertTrue( ebaFile.exists() );
 
         //expected files/directories inside the eba file
-        expectedFiles = new ArrayList();
+        List expectedFiles = new ArrayList();
 
         expectedFiles.add( "META-INF/maven/org.apache.maven.test/maven-eba-test/pom.properties"
);
         expectedFiles.add( "META-INF/maven/org.apache.maven.test/maven-eba-test/pom.xml"
);
@@ -229,32 +166,6 @@
 
         mojo.execute();
 
-        //check the working directory
-        File workDirectory = new File( workDir );
-
-        assertTrue( workDirectory.exists() );
-
-        assertTrue( workDirectory.isDirectory() );
-
-        File[] fileNames = workDirectory.listFiles();
-
-        List expectedFiles = new ArrayList();
-        List fileList = new ArrayList();
-
-        for( int i=0; i<fileNames.length; i++ )
-        {
-            addFileToList( fileNames[i], fileList );
-        }
-
-        expectedFiles.add( "application.mf" );
-        expectedFiles.add( "maven-artifact01-1.0-SNAPSHOT.jar" );
-        expectedFiles.add( "maven-artifact02-1.0-SNAPSHOT.jar" );
-        expectedFiles.add( "META-INF" );
-        expectedFiles.add( "MANIFEST.MF" );
-
-        assertEquals( expectedFiles.size(), fileList.size() );
-
-        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );
 
         //check the generated eba file
         File ebaFile = new File( outputDir, finalName + ".eba" );
@@ -262,7 +173,7 @@
         assertTrue( ebaFile.exists() );
 
         //expected files/directories inside the eba file
-        expectedFiles = new ArrayList();
+        List expectedFiles = new ArrayList();
 
         expectedFiles.add( "META-INF/maven/org.apache.maven.test/maven-eba-test/pom.properties"
);
         expectedFiles.add( "META-INF/maven/org.apache.maven.test/maven-eba-test/pom.xml"
);



Mime
View raw message