Skip to content

Commit

Permalink
update build chain (basepom#38)
Browse files Browse the repository at this point in the history
Updates to current tool chain

* Update basepom, rework some of the code to get rid of spotbugs errors.
* use openjdk as default
* update travis
  • Loading branch information
hgschmie committed Oct 21, 2019
1 parent a8f9f3c commit 7041897
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 100 deletions.
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 21 additions & 43 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<parent>
<groupId>org.basepom</groupId>
<artifactId>basepom-oss</artifactId>
<version>25</version>
<version>30</version>
</parent>

<groupId>org.basepom.maven</groupId>
Expand Down Expand Up @@ -74,22 +74,14 @@
</contributors>

<properties>
<!-- switch to spotbugs -->
<basepom.check.skip-findbugs>true</basepom.check.skip-findbugs>
<basepom.check.skip-spotbugs>${basepom.check.skip-extended}</basepom.check.skip-spotbugs>
<basepom.check.fail-spotbugs>${basepom.check.fail-extended}</basepom.check.fail-spotbugs>

<dep.basepom-policy.version>6</dep.basepom-policy.version>
<dep.spotbugs.version>3.1.1</dep.spotbugs.version>

<project.build.targetJdk>1.8</project.build.targetJdk>

<dep.maven-api.version>3.0</dep.maven-api.version>
<dep.plexus.version>1.5.5</dep.plexus.version>
<dep.plugin.plugin.version>3.4</dep.plugin.plugin.version>
<dep.groovy.version>2.4.12</dep.groovy.version>
<dep.slf4j.version>1.7.21</dep.slf4j.version>
<dep.guava.version>19.0</dep.guava.version>
<dep.plexus.version>2.0.0</dep.plexus.version>
<dep.plugin.plugin.version>3.6.0</dep.plugin.plugin.version>
<dep.groovy.version>3.0.0-beta-3</dep.groovy.version>
<dep.slf4j.version>1.7.28</dep.slf4j.version>
<dep.guava.version>28.1-jre</dep.guava.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -182,7 +174,7 @@
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>${dep.findbugs.version}</version>
<version>3.0.2</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -244,7 +236,13 @@

<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<artifactId>groovy</artifactId>
<version>${dep.groovy.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-xml</artifactId>
<version>${dep.groovy.version}</version>
<scope>test</scope>
</dependency>
Expand All @@ -261,7 +259,7 @@
<toolchains>
<jdk>
<version>${project.build.targetJdk}</version>
<vendor>sun</vendor>
<vendor>openjdk</vendor>
</jdk>
</toolchains>
</configuration>
Expand Down Expand Up @@ -417,31 +415,6 @@
</executions>
</plugin>

<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<configuration>
<excludeFilterFile>${project.basedir}/src/build/findbugsExcludeFilter.xml</excludeFilterFile>
</configuration>
<executions>
<execution>
<id>default</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<excludeFilterFile>${project.basedir}/src/build/findbugsExcludeFilter.xml</excludeFilterFile>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
Expand Down Expand Up @@ -469,7 +442,12 @@
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<artifactId>groovy</artifactId>
<version>${dep.groovy.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-xml</artifactId>
<version>${dep.groovy.version}</version>
</dependency>
</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions src/build/travis-toolchains.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>sun</vendor>
<vendor>openjdk</vendor>
</provides>
<configuration>
<!-- Location of a JDK8 in the Travis build environment -->
<jdkHome>/usr/lib/jvm/java-8-oracle</jdkHome>
<jdkHome>/usr/lib/jvm/java-8-openjdk-amd64</jdkHome>
</configuration>
</toolchain>
</toolchains>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -251,12 +249,6 @@ public boolean equals(Object o)

public static Function<ClasspathElement, String> getNameFunction()
{
return new Function<ClasspathElement, String>() {
@Override
public String apply(@Nonnull ClasspathElement element)
{
return element.getName();
}
};
return ClasspathElement::getName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -488,18 +488,12 @@ private void checkForDuplicates(final ConflictType type, final ResultCollector r
{
// only look at entries with a size > 1.
final Map<String, Collection<File>> filteredMap = ImmutableMap.copyOf(Maps.filterEntries(classpathDescriptor.getClasspathElementLocations(type),
new Predicate<Entry<String, Collection<File>>>() {

@Override
public boolean apply(@Nonnull final Entry<String, Collection<File>> 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<String, Collection<File>> entry : filteredMap.entrySet()) {
final String name = entry.getKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -84,16 +81,11 @@ public void addConflict(ConflictType type, String name, SortedSet<ClasspathEleme

public Map<String, Collection<ConflictResult>> getResults(final ConflictType type, final ConflictState state)
{
Multimap<String, ConflictResult> result = Multimaps.filterValues(results, new Predicate<ConflictResult>() {

@Override
public boolean apply(@Nonnull ConflictResult conflictResult)
{
checkNotNull(conflictResult, "conflictResult is null");
return conflictResult.getConflictState() == state
&& conflictResult.getType() == type
&& !conflictResult.isExcepted();
}
Multimap<String, ConflictResult> result = Multimaps.filterValues(results, conflictResult -> {
checkNotNull(conflictResult, "conflictResult is null");
return conflictResult.getConflictState() == state
&& conflictResult.getType() == type
&& !conflictResult.isExcepted();
});

return ImmutableMap.copyOf(result.asMap());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -41,20 +39,20 @@ public class MatchArtifactPredicate implements Predicate<Artifact>
}

@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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -49,13 +47,14 @@ public ImmutableList<Pattern> 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;
Expand Down

0 comments on commit 7041897

Please sign in to comment.