You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2012/08/27 19:07:05 UTC

svn commit: r1377745 - in /maven/plugins/trunk/maven-dependency-plugin: ./ src/main/java/org/apache/maven/plugin/dependency/ src/test/java/org/apache/maven/plugin/dependency/ src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/ src/test/...

Author: olamy
Date: Mon Aug 27 17:07:04 2012
New Revision: 1377745

URL: http://svn.apache.org/viewvc?rev=1377745&view=rev
Log:
[MDEP-371] useJvmChmod true by default.

Modified:
    maven/plugins/trunk/maven-dependency-plugin/pom.xml
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo2.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/unpack-dependencies-test/plugin-config.xml

Modified: maven/plugins/trunk/maven-dependency-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/pom.xml?rev=1377745&r1=1377744&r2=1377745&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-dependency-plugin/pom.xml Mon Aug 27 17:07:04 2012
@@ -254,6 +254,7 @@ under the License.
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.12.2</version>
         <configuration>
           <!-- Need of more head space in order to run the unit tests !-->
           <argLine>-Xmx256m</argLine>

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java?rev=1377745&r1=1377744&r2=1377745&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java Mon Aug 27 17:07:04 2012
@@ -102,8 +102,8 @@ public abstract class AbstractDependency
      *
      * @since 2.5.1
      */
-    @Parameter( property = "dependency.useJvmChmod", defaultValue = "false" )
-    private boolean useJvmChmod;
+    @Parameter( property = "dependency.useJvmChmod", defaultValue = "true" )
+    protected boolean useJvmChmod;
 
     /**
      * POM
@@ -405,6 +405,16 @@ public abstract class AbstractDependency
         this.artifactMetadataSource = theArtifactMetadataSource;
     }
 
+    public boolean isUseJvmChmod()
+    {
+        return useJvmChmod;
+    }
+
+    public void setUseJvmChmod( boolean useJvmChmod )
+    {
+        this.useJvmChmod = useJvmChmod;
+    }
+
     private void logUnpack( File file, File location, String includes, String excludes )
     {
         if ( !getLog().isInfoEnabled() )

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo.java?rev=1377745&r1=1377744&r2=1377745&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo.java Mon Aug 27 17:07:04 2012
@@ -19,12 +19,6 @@ package org.apache.maven.plugin.dependen
  * under the License.    
  */
 
-import java.io.File;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -37,6 +31,12 @@ import org.apache.maven.plugin.testing.s
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.StringUtils;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
 public class TestUnpackDependenciesMojo
     extends AbstractDependencyMojoTestCase
 {
@@ -56,6 +56,7 @@ public class TestUnpackDependenciesMojo
         File testPom = new File( getBasedir(), "target/test-classes/unit/unpack-dependencies-test/plugin-config.xml" );
         mojo = (UnpackDependenciesMojo) lookupMojo( "unpack-dependencies", testPom );
         mojo.outputDirectory = new File( this.testDir, "outputDirectory" );
+        mojo.useJvmChmod = true;
         // mojo.silent = true;
 
         // it needs to get the archivermanager
@@ -77,27 +78,26 @@ public class TestUnpackDependenciesMojo
         mojo.markersDirectory = new File( this.testDir, "markers" );
 
     }
-    
+
     protected void tearDown()
     {
         super.tearDown();
-        
+
         mojo = null;
         System.gc();
     }
 
     public void assertUnpacked( Artifact artifact )
-    {                
+    {
         assertUnpacked( true, artifact );
     }
 
     public void assertUnpacked( boolean val, Artifact artifact )
     {
-        File folder = DependencyUtil.getFormattedOutputDirectory( mojo.useSubDirectoryPerScope,
-                                                                  mojo.useSubDirectoryPerType,
-                                                                  mojo.useSubDirectoryPerArtifact,
-                                                                  mojo.useRepositoryLayout, mojo.stripVersion,
-                                                                  mojo.outputDirectory, artifact );
+        File folder =
+            DependencyUtil.getFormattedOutputDirectory( mojo.useSubDirectoryPerScope, mojo.useSubDirectoryPerType,
+                                                        mojo.useSubDirectoryPerArtifact, mojo.useRepositoryLayout,
+                                                        mojo.stripVersion, mojo.outputDirectory, artifact );
 
         File destFile = new File( folder, DependencyArtifactStubFactory.getUnpackableFileName( artifact ) );
 
@@ -270,7 +270,7 @@ public class TestUnpackDependenciesMojo
 
             assertUnpacked( false, artifact );
         }
-        
+
         mojo.excludeTypes = "";
         mojo.execute();
 
@@ -465,7 +465,7 @@ public class TestUnpackDependenciesMojo
             Artifact artifact = iter.next();
             assertUnpacked( false, artifact );
         }
-        mojo.excludeArtifactIds ="";
+        mojo.excludeArtifactIds = "";
         mojo.execute();
 
         iter = mojo.project.getArtifacts().iterator();
@@ -520,7 +520,7 @@ public class TestUnpackDependenciesMojo
         mojo.includeGroupIds = "one";
         mojo.excludeGroupIds = "one";
         //shouldn't get anything
-        
+
         mojo.execute();
 
         Iterator<Artifact> iter = mojo.project.getArtifacts().iterator();
@@ -530,7 +530,7 @@ public class TestUnpackDependenciesMojo
             // Testing with artifact id because group id is not in filename
             assertUnpacked( false, artifact );
         }
-        
+
         mojo.excludeGroupIds = "";
         mojo.execute();
 
@@ -541,7 +541,7 @@ public class TestUnpackDependenciesMojo
             // Testing with artifact id because group id is not in filename
             assertUnpacked( artifact.getGroupId().equals( "one" ), artifact );
         }
-        
+
     }
 
     public void testCDMClassifier()
@@ -590,8 +590,9 @@ public class TestUnpackDependenciesMojo
                     useType = testType;
                 }
             }
-            Artifact unpacked = stubFactory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact
-                .getVersion(), Artifact.SCOPE_COMPILE, useType, useClassifier );
+            Artifact unpacked =
+                stubFactory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
+                                            Artifact.SCOPE_COMPILE, useType, useClassifier );
             assertUnpacked( unpacked );
         }
     }
@@ -630,9 +631,11 @@ public class TestUnpackDependenciesMojo
 
     public File getUnpackedFile( Artifact artifact )
     {
-        File destDir = DependencyUtil.getFormattedOutputDirectory( mojo.isUseSubDirectoryPerScope(), mojo.isUseSubDirectoryPerType(), mojo
-            .isUseSubDirectoryPerArtifact(), mojo.useRepositoryLayout, mojo.stripVersion, mojo.getOutputDirectory(),
-                                                                   artifact );
+        File destDir = DependencyUtil.getFormattedOutputDirectory( mojo.isUseSubDirectoryPerScope(),
+                                                                   mojo.isUseSubDirectoryPerType(),
+                                                                   mojo.isUseSubDirectoryPerArtifact(),
+                                                                   mojo.useRepositoryLayout, mojo.stripVersion,
+                                                                   mojo.getOutputDirectory(), artifact );
         File unpacked = new File( destDir, DependencyArtifactStubFactory.getUnpackableFileName( artifact ) );
         assertTrue( unpacked.exists() );
         return unpacked;
@@ -643,7 +646,7 @@ public class TestUnpackDependenciesMojo
         return new DefaultFileMarkerHandler( artifact, mojo.getMarkersDirectory() );
     }
 
-   
+
     public void assertUnpacked( Artifact artifact, boolean overWrite )
         throws InterruptedException, MojoExecutionException
     {

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo2.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo2.java?rev=1377745&r1=1377744&r2=1377745&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo2.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo2.java Mon Aug 27 17:07:04 2012
@@ -19,17 +19,17 @@ package org.apache.maven.plugin.dependen
  * under the License.    
  */
 
-import java.io.File;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.dependency.testUtils.DependencyArtifactStubFactory;
 import org.apache.maven.plugin.dependency.utils.DependencyUtil;
 import org.apache.maven.project.MavenProject;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
 public class TestUnpackDependenciesMojo2
     extends AbstractDependencyMojoTestCase
 {
@@ -49,6 +49,7 @@ public class TestUnpackDependenciesMojo2
         File testPom = new File( getBasedir(), "target/test-classes/unit/unpack-dependencies-test/plugin-config.xml" );
         mojo = (UnpackDependenciesMojo) lookupMojo( "unpack-dependencies", testPom );
         mojo.outputDirectory = new File( this.testDir, "outputDirectory" );
+        mojo.useJvmChmod = true;
         // mojo.silent = true;
 
         // it needs to get the archivermanager
@@ -70,20 +71,22 @@ public class TestUnpackDependenciesMojo2
         mojo.markersDirectory = new File( this.testDir, "markers" );
 
     }
-    
+
     protected void tearDown()
     {
         super.tearDown();
-        
+
         mojo = null;
         System.gc();
     }
 
     public File getUnpackedFile( Artifact artifact )
     {
-        File destDir = DependencyUtil.getFormattedOutputDirectory( mojo.isUseSubDirectoryPerScope(), mojo.isUseSubDirectoryPerType(), mojo
-            .isUseSubDirectoryPerArtifact(), mojo.useRepositoryLayout, mojo.stripVersion, mojo.getOutputDirectory(),
-                                                                   artifact );
+        File destDir = DependencyUtil.getFormattedOutputDirectory( mojo.isUseSubDirectoryPerScope(),
+                                                                   mojo.isUseSubDirectoryPerType(),
+                                                                   mojo.isUseSubDirectoryPerArtifact(),
+                                                                   mojo.useRepositoryLayout, mojo.stripVersion,
+                                                                   mojo.getOutputDirectory(), artifact );
         File unpacked = new File( destDir, DependencyArtifactStubFactory.getUnpackableFileName( artifact ) );
         assertTrue( unpacked.exists() );
         return unpacked;
@@ -217,7 +220,7 @@ public class TestUnpackDependenciesMojo2
         mojo.execute();
 
         assertTrue( time != unpackedFile.lastModified() );
-        
+
         System.gc();
     }
 

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java?rev=1377745&r1=1377744&r2=1377745&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java Mon Aug 27 17:07:04 2012
@@ -76,6 +76,7 @@ public class TestUnpackMojo
         mojo.setResolver( new StubArtifactResolver( stubFactory, false, false ) );
         mojo.setLocal( new StubArtifactRepository( this.testDir.getAbsolutePath() ) );
         mojo.setArtifactCollector( new StubArtifactCollector() );
+        mojo.setUseJvmChmod( true );
     }
 
     public ArtifactItem getSingleArtifactItem( boolean removeVersion )

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/unpack-dependencies-test/plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/unpack-dependencies-test/plugin-config.xml?rev=1377745&r1=1377744&r2=1377745&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/unpack-dependencies-test/plugin-config.xml (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/unpack-dependencies-test/plugin-config.xml Mon Aug 27 17:07:04 2012
@@ -23,8 +23,9 @@
       <plugin>
         <artifactId>maven-dependency-plugin</artifactId>
           <configuration>
-              <project implementation="org.apache.maven.plugin.dependency.testUtils.stubs.DependencyProjectStub"/>
-              <silent>true</silent>
+            <project implementation="org.apache.maven.plugin.dependency.testUtils.stubs.DependencyProjectStub"/>
+            <silent>true</silent>
+            <useJvmChmod>true</useJvmChmod>
           </configuration>
       </plugin>
     </plugins>