[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
diff --git a/pom.xml b/pom.xml
index e29db42..fd3f046 100644
--- a/pom.xml
+++ b/pom.xml
@@ -82,6 +82,16 @@
<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 @@
</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..8c11d18 100644
--- a/src/it/reproducible/verify.groovy
+++ b/src/it/reproducible/verify.groovy
@@ -82,4 +82,5 @@
String buf = r.toString()
println buf
-assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = f159379802c1f0dc1083af21352286b09d364519" )
+// on Windows executable bit is not set
+assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = f159379802c1f0dc1083af21352286b09d364519" ) || 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.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 @@
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 @@
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 @@
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 @@
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));
}