Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require Java 8 #134

Merged
merged 1 commit into from
Jul 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 4 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
-->
<enforcerPluginVersion>1.4</enforcerPluginVersion>
<maven.version>2.0.9</maven.version>
<mojo.java.target>1.8</mojo.java.target>
<scmpublish.content>target/staging/${project.artifactId}</scmpublish.content>
<project.build.outputTimestamp>2021-02-06T08:02:09Z</project.build.outputTimestamp>
</properties>
Expand Down Expand Up @@ -210,10 +211,6 @@
<preBuildHookScript>setup</preBuildHookScript>
<postBuildHookScript>verify</postBuildHookScript>
<addTestClassPath>true</addTestClassPath>
<properties>
<!-- e.g. ensure that Java7 picks up TLSv1.2 when connecting with Central -->
<https.protocols>TLSv1.2</https.protocols>
</properties>
<filterProperties>
<enforcerPluginVersion>${enforcerPluginVersion}</enforcerPluginVersion>
</filterProperties>
Expand Down Expand Up @@ -249,9 +246,9 @@
<jdk>[12,)</jdk>
</activation>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.release>7</maven.compiler.release>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.release>8</maven.compiler.release>
</properties>
</profile>
</profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ final Set<String> getRolesFromProject( MavenProject mavenProject )
*/
Set<String> getRolesFromString( final String toSet )
{
final List<String> asList = Arrays.asList( StringUtils.split( toSet, "," ) );
final String[] asList = StringUtils.split( toSet, "," );
final Set<String> result = new HashSet<>();
for ( String role : asList )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 " );
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected void handleArtifacts( Set<Artifact> artifacts ) throws EnforcerRuleExc
{
if( getLog().isDebugEnabled() )
{
getLog().debug( "Skipping " + o.toString() + " due to scope" );
getLog().debug( "Skipping " + o + " due to scope" );
}
continue;
}
Expand All @@ -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 ) )
Expand All @@ -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 );
}
}
}
Expand Down Expand Up @@ -267,19 +267,18 @@ private void checkAndAddName( Artifact artifact, String pathToClassFile, Map<Str
{
Artifact previousArtifact = classesWithSameName.previous().getArtifactThisClassWasFoundIn();

StringBuilder buf = new StringBuilder( message == null ? "Duplicate class found:" : message );
buf.append( '\n' );
buf.append( "\n Found in:" );
buf.append( "\n " );
buf.append( previousArtifact );
buf.append( "\n " );
buf.append( artifact );
buf.append( "\n Duplicate classes:" );
buf.append( "\n " );
buf.append( pathToClassFile );
buf.append( '\n' );
buf.append( "There may be others but <findAllDuplicates> 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 <findAllDuplicates> was set to false, so failing fast";
throw new EnforcerRuleException( buf );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ protected void handleArtifacts( Set<Artifact> 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 );
}
Expand Down Expand Up @@ -432,7 +432,7 @@ public void setSearchTransitive( boolean theSearchTransitive )
*/
private Set<Artifact> filterArtifacts( Set<Artifact> dependencies )
{
if ( includes == null && excludes == null && ignoredScopes == null && ignoreOptionals == false )
if ( includes == null && excludes == null && ignoredScopes == null && !ignoreOptionals )
{
return dependencies;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/freebsd/file/FileEncoding.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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;
Expand All @@ -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) );
}
}