Skip to content

Commit f186993

Browse files
[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
1 parent 021af55 commit f186993

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

pom.xml

+15-5
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ under the License.
8282
<project.build.outputTimestamp>2019-12-16T18:10:36Z</project.build.outputTimestamp>
8383
</properties>
8484

85+
<dependencyManagement>
86+
<dependencies>
87+
<dependency>
88+
<groupId>commons-io</groupId>
89+
<artifactId>commons-io</artifactId>
90+
<version>2.11.0</version>
91+
</dependency>
92+
</dependencies>
93+
</dependencyManagement>
94+
8595
<dependencies>
8696
<dependency>
8797
<groupId>org.apache.maven</groupId>
@@ -122,13 +132,13 @@ under the License.
122132
</dependency>
123133
<dependency>
124134
<groupId>org.codehaus.plexus</groupId>
125-
<artifactId>plexus-utils</artifactId>
126-
<version>3.4.2</version>
135+
<artifactId>plexus-archiver</artifactId>
136+
<version>4.7.1</version>
127137
</dependency>
128138
<dependency>
129-
<groupId>commons-io</groupId>
130-
<artifactId>commons-io</artifactId>
131-
<version>2.11.0</version>
139+
<groupId>org.codehaus.plexus</groupId>
140+
<artifactId>plexus-utils</artifactId>
141+
<version>3.5.1</version>
132142
</dependency>
133143

134144
<dependency>

src/it/reproducible/verify.groovy

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,5 @@ zipFile.close();
8282
String buf = r.toString()
8383
println buf
8484

85-
assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = f159379802c1f0dc1083af21352286b09d364519" )
85+
// on Windows executable bit is not set
86+
assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = f159379802c1f0dc1083af21352286b09d364519" ) || buf.startsWith( "reproducible-1.0-sources.jar sha1 = e14cb3b37b6d82db1728886d1959ad0cd79708d8" )

src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.codehaus.plexus.archiver.ArchiverException;
4242
import org.codehaus.plexus.archiver.jar.JarArchiver;
4343
import org.codehaus.plexus.archiver.jar.ManifestException;
44+
import org.codehaus.plexus.archiver.util.DefaultFileSet;
4445
import org.codehaus.plexus.util.FileUtils;
4546

4647
/**
@@ -420,8 +421,7 @@ protected void addDirectory(Archiver archiver, File sourceDirectory, String[] pI
420421
throws MojoExecutionException {
421422
try {
422423
getLog().debug("add directory " + sourceDirectory + " to archiver");
423-
// archiver.addFileSet( fileSet );
424-
archiver.addDirectory(sourceDirectory, pIncludes, pExcludes);
424+
archiver.addFileSet(DefaultFileSet.fileSet(sourceDirectory).includeExclude(pIncludes, pExcludes));
425425
} catch (ArchiverException e) {
426426
throw new MojoExecutionException("Error adding directory to source archive.", e);
427427
}
@@ -440,7 +440,8 @@ protected void addDirectory(
440440
throws MojoExecutionException {
441441
try {
442442
getLog().debug("add directory " + sourceDirectory + " to archiver with prefix " + prefix);
443-
archiver.addDirectory(sourceDirectory, prefix, pIncludes, pExcludes);
443+
archiver.addFileSet(
444+
DefaultFileSet.fileSet(sourceDirectory).prefixed(prefix).includeExclude(pIncludes, pExcludes));
444445
} catch (ArchiverException e) {
445446
throw new MojoExecutionException("Error adding directory to source archive.", e);
446447
}
@@ -486,12 +487,12 @@ private String[] getCombinedIncludes(List<String> additionalIncludes) {
486487
combinedIncludes.addAll(Arrays.asList(includes));
487488
}
488489

489-
if (additionalIncludes != null && additionalIncludes.size() > 0) {
490+
if (additionalIncludes != null && !additionalIncludes.isEmpty()) {
490491
combinedIncludes.addAll(additionalIncludes);
491492
}
492493

493494
// If there are no other includes, use the default.
494-
if (combinedIncludes.size() == 0) {
495+
if (combinedIncludes.isEmpty()) {
495496
combinedIncludes.addAll(Arrays.asList(DEFAULT_INCLUDES));
496497
}
497498

@@ -516,11 +517,11 @@ private String[] getCombinedExcludes(List<String> additionalExcludes) {
516517
combinedExcludes.addAll(Arrays.asList(excludes));
517518
}
518519

519-
if (additionalExcludes != null && additionalExcludes.size() > 0) {
520+
if (additionalExcludes != null && !additionalExcludes.isEmpty()) {
520521
combinedExcludes.addAll(additionalExcludes);
521522
}
522523

523-
if (combinedExcludes.size() == 0) {
524+
if (combinedExcludes.isEmpty()) {
524525
combinedExcludes.addAll(Arrays.asList(DEFAULT_EXCLUDES));
525526
}
526527

0 commit comments

Comments
 (0)