diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 36c86d7a..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-# Need trusty distro to work with java <9
-dist: trusty
-language: java
-env:
- - MAVEN_VERSION=3.3.9
- - MAVEN_VERSION=3.5.4
- - MAVEN_VERSION=3.6.3
-jdk:
- - openjdk7
- - openjdk8
- - openjdk11
- - openjdk-ea
-install:
- # Specify version of io.takari:maven that supports Java 7
- - "mvn -N io.takari:maven:0.5.0:wrapper -Dmaven=${MAVEN_VERSION} -Dhttps.protocols=TLSv1.2"
- - "./mvnw --show-version --errors --batch-mode validate dependency:go-offline"
-script:
- - "./mvnw --show-version --errors --batch-mode clean verify"
-cache:
- directories:
- - $HOME/.m2
-branches:
- except:
- - gh-pages
-notifications:
- email:
- - mfriedenhagen@apache.org
- - khmarbaise@apache.org
diff --git a/appveyor.yml b/appveyor.yml
index c5c5086e..3433fd19 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -5,11 +5,10 @@ skip_tags: true
clone_depth: 10
environment:
matrix:
- - JAVA_HOME: C:\Program Files\Java\jdk1.7.0
- JAVA_HOME: C:\Program Files\Java\jdk1.8.0
- JAVA_HOME: C:\Program Files\Java\jdk11
build_script:
- - mvn -B -V clean verify -Dhttps.protocols=TLSv1.2
+ - mvn -B -V clean verify
cache:
- C:\Users\appveyor\.m2
diff --git a/pom.xml b/pom.xml
index 14ddfca3..d09dde0c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -93,6 +93,7 @@
-->
1.4
2.0.9
+ 1.8
target/staging/${project.artifactId}
2021-02-06T08:02:09Z
@@ -210,10 +211,6 @@
setup
verify
true
-
-
- TLSv1.2
-
${enforcerPluginVersion}
@@ -249,9 +246,9 @@
[12,)
- 1.7
- 1.7
- 7
+ 1.8
+ 1.8
+ 8
diff --git a/src/main/java/org/apache/maven/plugins/enforcer/AbstractRequireRoles.java b/src/main/java/org/apache/maven/plugins/enforcer/AbstractRequireRoles.java
index e3808d55..2443cd73 100644
--- a/src/main/java/org/apache/maven/plugins/enforcer/AbstractRequireRoles.java
+++ b/src/main/java/org/apache/maven/plugins/enforcer/AbstractRequireRoles.java
@@ -146,7 +146,7 @@ final Set getRolesFromProject( MavenProject mavenProject )
*/
Set getRolesFromString( final String toSet )
{
- final List asList = Arrays.asList( StringUtils.split( toSet, "," ) );
+ final String[] asList = StringUtils.split( toSet, "," );
final Set result = new HashSet<>();
for ( String role : asList )
{
diff --git a/src/main/java/org/apache/maven/plugins/enforcer/BanCircularDependencies.java b/src/main/java/org/apache/maven/plugins/enforcer/BanCircularDependencies.java
index b1d001c5..cb5f6d8f 100644
--- a/src/main/java/org/apache/maven/plugins/enforcer/BanCircularDependencies.java
+++ b/src/main/java/org/apache/maven/plugins/enforcer/BanCircularDependencies.java
@@ -92,9 +92,8 @@ public void execute( EnforcerRuleHelper helper )
log.debug( "artifactId: " + artifact.getArtifactId() + " " + project.getArtifactId() );
if ( artifact.getArtifactId().equals( project.getArtifactId() ) )
{
- StringBuilder buf = new StringBuilder( getErrorMessage() );
- buf.append( "\n " ).append( artifact.getGroupId() ).append( ":" ).append( artifact.getArtifactId() ).append( "\n " );
- throw new EnforcerRuleException( buf.toString() );
+ throw new EnforcerRuleException( getErrorMessage() + "\n " + artifact.getGroupId()
+ + ":" + artifact.getArtifactId() + "\n " );
}
}
}
diff --git a/src/main/java/org/apache/maven/plugins/enforcer/BanDuplicateClasses.java b/src/main/java/org/apache/maven/plugins/enforcer/BanDuplicateClasses.java
index 38de0d20..70504c22 100644
--- a/src/main/java/org/apache/maven/plugins/enforcer/BanDuplicateClasses.java
+++ b/src/main/java/org/apache/maven/plugins/enforcer/BanDuplicateClasses.java
@@ -134,7 +134,7 @@ protected void handleArtifacts( Set artifacts ) throws EnforcerRuleExc
{
if( getLog().isDebugEnabled() )
{
- getLog().debug( "Skipping " + o.toString() + " due to scope" );
+ getLog().debug( "Skipping " + o + " due to scope" );
}
continue;
}
@@ -157,7 +157,7 @@ else if ( file.isDirectory() )
catch ( IOException e )
{
throw new EnforcerRuleException(
- "Unable to process dependency " + o.toString() + " due to " + e.getLocalizedMessage(), e );
+ "Unable to process dependency " + o + " due to " + e.getLocalizedMessage(), e );
}
}
else if ( isJarFile( o ) )
@@ -177,7 +177,7 @@ else if ( isJarFile( o ) )
catch ( IOException e )
{
throw new EnforcerRuleException(
- "Unable to process dependency " + o.toString() + " due to " + e.getLocalizedMessage(), e );
+ "Unable to process dependency " + o + " due to " + e.getLocalizedMessage(), e );
}
}
}
@@ -267,19 +267,18 @@ private void checkAndAddName( Artifact artifact, String pathToClassFile, Map was set to false, so failing fast" );
- throw new EnforcerRuleException( buf.toString() );
+ String buf = ( message == null ? "Duplicate class found:" : message ) + '\n'
+ + "\n Found in:"
+ + "\n "
+ + previousArtifact
+ + "\n "
+ + artifact
+ + "\n Duplicate classes:"
+ + "\n "
+ + pathToClassFile
+ + '\n'
+ + "There may be others but was set to false, so failing fast";
+ throw new EnforcerRuleException( buf );
}
}
}
diff --git a/src/main/java/org/apache/maven/plugins/enforcer/EnforceBytecodeVersion.java b/src/main/java/org/apache/maven/plugins/enforcer/EnforceBytecodeVersion.java
index 64d21a7f..9fa2756d 100644
--- a/src/main/java/org/apache/maven/plugins/enforcer/EnforceBytecodeVersion.java
+++ b/src/main/java/org/apache/maven/plugins/enforcer/EnforceBytecodeVersion.java
@@ -201,7 +201,7 @@ protected void handleArtifacts( Set artifacts )
{
buf.append( getErrorMessage( artifact ) );
}
- message = buf.toString() + "Use 'mvn dependency:tree' to locate the source of the banned dependencies.";
+ message = buf + "Use 'mvn dependency:tree' to locate the source of the banned dependencies.";
throw new EnforcerRuleException( message );
}
@@ -432,7 +432,7 @@ public void setSearchTransitive( boolean theSearchTransitive )
*/
private Set filterArtifacts( Set dependencies )
{
- if ( includes == null && excludes == null && ignoredScopes == null && ignoreOptionals == false )
+ if ( includes == null && excludes == null && ignoredScopes == null && !ignoreOptionals )
{
return dependencies;
}
diff --git a/src/main/java/org/freebsd/file/FileEncoding.java b/src/main/java/org/freebsd/file/FileEncoding.java
index 7af0c381..b016d5a5 100644
--- a/src/main/java/org/freebsd/file/FileEncoding.java
+++ b/src/main/java/org/freebsd/file/FileEncoding.java
@@ -387,7 +387,7 @@ private int looks_ucs16( byte[] buf, int nbytes )
{
return 0;
}
- if ( ubuf[ ulen - 1 ] < 128 && text_chars[ (int) ubuf[ ulen - 1 ] ] != T )
+ if ( ubuf[ ulen - 1 ] < 128 && text_chars[ubuf[ ulen - 1 ]] != T )
{
return 0;
}
diff --git a/src/test/java/org/apache/maven/plugins/enforcer/RequireEncodingTest.java b/src/test/java/org/apache/maven/plugins/enforcer/RequireEncodingTest.java
index da44148a..77b85d74 100644
--- a/src/test/java/org/apache/maven/plugins/enforcer/RequireEncodingTest.java
+++ b/src/test/java/org/apache/maven/plugins/enforcer/RequireEncodingTest.java
@@ -1,5 +1,6 @@
package org.apache.maven.plugins.enforcer;
+import static org.junit.Assert.assertThrows;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -9,13 +10,9 @@
import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
import org.apache.maven.plugin.logging.Log;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
public class RequireEncodingTest {
- @Rule
- public ExpectedException exception = ExpectedException.none();
private EnforcerRuleHelper helper;
private RequireEncoding rule;
@@ -35,7 +32,6 @@ public void failUTF8() throws Exception {
rule.setIncludes("ascii.txt");
- exception.expect(EnforcerRuleException.class);
- rule.execute(helper);
+ assertThrows(EnforcerRuleException.class, () -> rule.execute(helper) );
}
}