diff --git a/.travis.yml b/.travis.yml index fbc1572b..db507f01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,17 +5,18 @@ cache: - $HOME/.m2 jdk: - - oraclejdk8 - - oraclejdk9 + - openjdk8 + - openjdk11 sudo: false before_install: - cp src/build/travis-toolchains.xml ~/.m2/toolchains.xml - - wget https://archive.apache.org/dist/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.zip - - unzip -qq apache-maven-3.5.2-bin.zip - - export M2_HOME=$PWD/apache-maven-3.5.2 + - wget https://archive.apache.org/dist/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.zip + - unzip -qq apache-maven-3.6.2-bin.zip + - export M2_HOME=$PWD/apache-maven-3.6.2 - export PATH=$M2_HOME/bin:$PATH + - mvn --version install: mvn -DskipTests=true -Dbasepom.check.skip-all=true -Dbasepom.it.skip=true -B -fae install script: mvn -B -fae verify diff --git a/pom.xml b/pom.xml index c167d9aa..2c33266f 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ org.basepom basepom-oss - 25 + 30 org.basepom.maven @@ -74,22 +74,14 @@ - - true - ${basepom.check.skip-extended} - ${basepom.check.fail-extended} - - 6 - 3.1.1 - 1.8 3.0 - 1.5.5 - 3.4 - 2.4.12 - 1.7.21 - 19.0 + 2.0.0 + 3.6.0 + 3.0.0-beta-3 + 1.7.28 + 28.1-jre @@ -182,7 +174,7 @@ com.google.code.findbugs jsr305 - ${dep.findbugs.version} + 3.0.2 @@ -244,7 +236,13 @@ org.codehaus.groovy - groovy-all + groovy + ${dep.groovy.version} + test + + + org.codehaus.groovy + groovy-xml ${dep.groovy.version} test @@ -261,7 +259,7 @@ ${project.build.targetJdk} - sun + openjdk @@ -417,31 +415,6 @@ - - com.github.spotbugs - spotbugs-maven-plugin - - ${project.basedir}/src/build/findbugsExcludeFilter.xml - - - - default - verify - - check - - - - - - - org.codehaus.mojo - findbugs-maven-plugin - - ${project.basedir}/src/build/findbugsExcludeFilter.xml - - - org.apache.maven.plugins maven-pmd-plugin @@ -469,7 +442,12 @@ org.codehaus.groovy - groovy-all + groovy + ${dep.groovy.version} + + + org.codehaus.groovy + groovy-xml ${dep.groovy.version} diff --git a/src/build/travis-toolchains.xml b/src/build/travis-toolchains.xml index d028ed24..ca0d3675 100644 --- a/src/build/travis-toolchains.xml +++ b/src/build/travis-toolchains.xml @@ -18,11 +18,11 @@ jdk 1.8 - sun + openjdk - /usr/lib/jvm/java-8-oracle + /usr/lib/jvm/java-8-openjdk-amd64 diff --git a/src/main/java/org/basepom/mojo/duplicatefinder/ClasspathElement.java b/src/main/java/org/basepom/mojo/duplicatefinder/ClasspathElement.java index b8ad6edf..379b0460 100644 --- a/src/main/java/org/basepom/mojo/duplicatefinder/ClasspathElement.java +++ b/src/main/java/org/basepom/mojo/duplicatefinder/ClasspathElement.java @@ -23,8 +23,6 @@ import java.io.File; import java.util.Objects; -import javax.annotation.Nonnull; - import com.google.common.base.Function; import com.google.common.base.Joiner; import com.google.common.collect.Ordering; @@ -251,12 +249,6 @@ public boolean equals(Object o) public static Function getNameFunction() { - return new Function() { - @Override - public String apply(@Nonnull ClasspathElement element) - { - return element.getName(); - } - }; + return ClasspathElement::getName; } } diff --git a/src/main/java/org/basepom/mojo/duplicatefinder/DuplicateFinderMojo.java b/src/main/java/org/basepom/mojo/duplicatefinder/DuplicateFinderMojo.java index 9f09122f..0488a7bd 100644 --- a/src/main/java/org/basepom/mojo/duplicatefinder/DuplicateFinderMojo.java +++ b/src/main/java/org/basepom/mojo/duplicatefinder/DuplicateFinderMojo.java @@ -488,18 +488,12 @@ private void checkForDuplicates(final ConflictType type, final ResultCollector r { // only look at entries with a size > 1. final Map> filteredMap = ImmutableMap.copyOf(Maps.filterEntries(classpathDescriptor.getClasspathElementLocations(type), - new Predicate>>() { - - @Override - public boolean apply(@Nonnull final Entry> entry) - { + entry -> { checkNotNull(entry, "entry is null"); checkState(entry.getValue() != null, "Entry '%s' is invalid", entry); return entry.getValue().size() > 1; - } - - })); + })); for (final Map.Entry> entry : filteredMap.entrySet()) { final String name = entry.getKey(); diff --git a/src/main/java/org/basepom/mojo/duplicatefinder/ResultCollector.java b/src/main/java/org/basepom/mojo/duplicatefinder/ResultCollector.java index 9c590af9..16fcd165 100644 --- a/src/main/java/org/basepom/mojo/duplicatefinder/ResultCollector.java +++ b/src/main/java/org/basepom/mojo/duplicatefinder/ResultCollector.java @@ -21,10 +21,7 @@ import java.util.Map; import java.util.SortedSet; -import javax.annotation.Nonnull; - import com.google.common.base.Joiner; -import com.google.common.base.Predicate; import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ListMultimap; @@ -84,16 +81,11 @@ public void addConflict(ConflictType type, String name, SortedSet> getResults(final ConflictType type, final ConflictState state) { - Multimap result = Multimaps.filterValues(results, new Predicate() { - - @Override - public boolean apply(@Nonnull ConflictResult conflictResult) - { - checkNotNull(conflictResult, "conflictResult is null"); - return conflictResult.getConflictState() == state - && conflictResult.getType() == type - && !conflictResult.isExcepted(); - } + Multimap result = Multimaps.filterValues(results, conflictResult -> { + checkNotNull(conflictResult, "conflictResult is null"); + return conflictResult.getConflictState() == state + && conflictResult.getType() == type + && !conflictResult.isExcepted(); }); return ImmutableMap.copyOf(result.asMap()); diff --git a/src/main/java/org/basepom/mojo/duplicatefinder/classpath/MatchArtifactPredicate.java b/src/main/java/org/basepom/mojo/duplicatefinder/classpath/MatchArtifactPredicate.java index a77fe3a1..74281cb3 100644 --- a/src/main/java/org/basepom/mojo/duplicatefinder/classpath/MatchArtifactPredicate.java +++ b/src/main/java/org/basepom/mojo/duplicatefinder/classpath/MatchArtifactPredicate.java @@ -18,8 +18,6 @@ import java.util.Collection; import java.util.List; -import javax.annotation.Nonnull; - import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; @@ -41,20 +39,20 @@ public class MatchArtifactPredicate implements Predicate } @Override - public boolean apply(@Nonnull final Artifact artifact) + public boolean apply(final Artifact artifact) { - for (final MavenCoordinates mavenCoordinate : mavenCoordinates) { - try { - if (mavenCoordinate.matches(artifact)) { - LOG.debug("Ignoring artifact '%s' (matches %s)", artifact, mavenCoordinate); - return true; + if (artifact != null) { + for (final MavenCoordinates mavenCoordinate : mavenCoordinates) { + try { + if (mavenCoordinate.matches(artifact)) { + LOG.debug("Ignoring artifact '%s' (matches %s)", artifact, mavenCoordinate); + return true; + } + } catch (final OverConstrainedVersionException e) { + LOG.warn("Caught '%s' while comparing '%s' to '%s'", e.getMessage(), mavenCoordinate, artifact); } } - catch (final OverConstrainedVersionException e) { - LOG.warn("Caught '%s' while comparing '%s' to '%s'", e.getMessage(), mavenCoordinate, artifact); - } } - return false; } } diff --git a/src/main/java/org/basepom/mojo/duplicatefinder/classpath/MatchPatternPredicate.java b/src/main/java/org/basepom/mojo/duplicatefinder/classpath/MatchPatternPredicate.java index 6f374375..9001377b 100644 --- a/src/main/java/org/basepom/mojo/duplicatefinder/classpath/MatchPatternPredicate.java +++ b/src/main/java/org/basepom/mojo/duplicatefinder/classpath/MatchPatternPredicate.java @@ -18,8 +18,6 @@ import java.util.Collection; import java.util.regex.Pattern; -import javax.annotation.Nonnull; - import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; @@ -49,13 +47,14 @@ public ImmutableList getPatterns() } @Override - public boolean apply(@Nonnull final String input) + public boolean apply(final String input) { - final String value = input; - for (final Pattern pattern : patterns) { - if (pattern.matcher(value).matches()) { - LOG.debug("Ignoring '%s' (matches %s)", input, pattern.pattern()); - return true; + if (input != null) { + for (final Pattern pattern : patterns) { + if (pattern.matcher(input).matches()) { + LOG.debug("Ignoring '%s' (matches %s)", input, pattern.pattern()); + return true; + } } } return false;