You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2023/05/15 21:45:12 UTC

[maven-source-plugin] branch MSOURCES-135 created (now 6fb3754)

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

sjaranowski pushed a change to branch MSOURCES-135
in repository https://gitbox.apache.org/repos/asf/maven-source-plugin.git


      at 6fb3754  [MSOURCES-135] Cleanup project code

This branch includes the following new commits:

     new 6fb3754  [MSOURCES-135] Cleanup project code

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-source-plugin] 01/01: [MSOURCES-135] Cleanup project code

Posted by sj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch MSOURCES-135
in repository https://gitbox.apache.org/repos/asf/maven-source-plugin.git

commit 6fb3754afca825cde1c6d8d3b8fe6f83f82f5768
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Mon May 15 23:44:50 2023 +0200

    [MSOURCES-135] Cleanup project code
    
    - fix dependencies according to output of dependency:analyze
    - bump plexus-utils to 3.5.1
    - don't use deprecated methods
---
 pom.xml                                              | 20 +++++++++++++++-----
 src/it/reproducible/verify.groovy                    |  2 +-
 .../maven/plugins/source/AbstractSourceJarMojo.java  | 15 ++++++++-------
 3 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/pom.xml b/pom.xml
index e29db42..fd3f046 100644
--- a/pom.xml
+++ b/pom.xml
@@ -82,6 +82,16 @@ under the License.
     <project.build.outputTimestamp>2019-12-16T18:10:36Z</project.build.outputTimestamp>
   </properties>
 
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>commons-io</groupId>
+        <artifactId>commons-io</artifactId>
+        <version>2.11.0</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
@@ -122,13 +132,13 @@ under the License.
     </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-utils</artifactId>
-      <version>3.4.2</version>
+      <artifactId>plexus-archiver</artifactId>
+      <version>4.7.1</version>
     </dependency>
     <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <version>2.11.0</version>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>3.5.1</version>
     </dependency>
 
     <dependency>
diff --git a/src/it/reproducible/verify.groovy b/src/it/reproducible/verify.groovy
index 19b8af7..8f96885 100644
--- a/src/it/reproducible/verify.groovy
+++ b/src/it/reproducible/verify.groovy
@@ -82,4 +82,4 @@ zipFile.close();
 String buf = r.toString()
 println buf
 
-assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = f159379802c1f0dc1083af21352286b09d364519" )
+assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = e14cb3b37b6d82db1728886d1959ad0cd79708d8" )
diff --git a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
index 52c0d75..f624be7 100644
--- a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
@@ -41,6 +41,7 @@ import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.archiver.jar.ManifestException;
+import org.codehaus.plexus.archiver.util.DefaultFileSet;
 import org.codehaus.plexus.util.FileUtils;
 
 /**
@@ -420,8 +421,7 @@ public abstract class AbstractSourceJarMojo extends AbstractMojo {
             throws MojoExecutionException {
         try {
             getLog().debug("add directory " + sourceDirectory + " to archiver");
-            // archiver.addFileSet( fileSet );
-            archiver.addDirectory(sourceDirectory, pIncludes, pExcludes);
+            archiver.addFileSet(DefaultFileSet.fileSet(sourceDirectory).includeExclude(pIncludes, pExcludes));
         } catch (ArchiverException e) {
             throw new MojoExecutionException("Error adding directory to source archive.", e);
         }
@@ -440,7 +440,8 @@ public abstract class AbstractSourceJarMojo extends AbstractMojo {
             throws MojoExecutionException {
         try {
             getLog().debug("add directory " + sourceDirectory + " to archiver with prefix " + prefix);
-            archiver.addDirectory(sourceDirectory, prefix, pIncludes, pExcludes);
+            archiver.addFileSet(
+                    DefaultFileSet.fileSet(sourceDirectory).prefixed(prefix).includeExclude(pIncludes, pExcludes));
         } catch (ArchiverException e) {
             throw new MojoExecutionException("Error adding directory to source archive.", e);
         }
@@ -486,12 +487,12 @@ public abstract class AbstractSourceJarMojo extends AbstractMojo {
             combinedIncludes.addAll(Arrays.asList(includes));
         }
 
-        if (additionalIncludes != null && additionalIncludes.size() > 0) {
+        if (additionalIncludes != null && !additionalIncludes.isEmpty()) {
             combinedIncludes.addAll(additionalIncludes);
         }
 
         // If there are no other includes, use the default.
-        if (combinedIncludes.size() == 0) {
+        if (combinedIncludes.isEmpty()) {
             combinedIncludes.addAll(Arrays.asList(DEFAULT_INCLUDES));
         }
 
@@ -516,11 +517,11 @@ public abstract class AbstractSourceJarMojo extends AbstractMojo {
             combinedExcludes.addAll(Arrays.asList(excludes));
         }
 
-        if (additionalExcludes != null && additionalExcludes.size() > 0) {
+        if (additionalExcludes != null && !additionalExcludes.isEmpty()) {
             combinedExcludes.addAll(additionalExcludes);
         }
 
-        if (combinedExcludes.size() == 0) {
+        if (combinedExcludes.isEmpty()) {
             combinedExcludes.addAll(Arrays.asList(DEFAULT_EXCLUDES));
         }