Skip to content

Commit

Permalink
Report artifact info
Browse files Browse the repository at this point in the history
When an error occurs, this information is provided by handleArtifacts.

For warnings, the only information is the information provided by the getLog().warn() call itself.

Without this change, the following output is common:
[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (display-info) @ acceptance-test-harness ---
[WARNING] Invalid bytecodeVersion for module-info.class: expected 52, but was 53
[WARNING] Invalid bytecodeVersion for module-info.class: expected 52, but was 53
[WARNING] Invalid bytecodeVersion for module-info.class: expected 52, but was 53
[WARNING] Invalid bytecodeVersion for module-info.class: expected 52, but was 53
[WARNING] Invalid bytecodeVersion for module-info.class: expected 52, but was 53
[WARNING] Invalid bytecodeVersion for module-info.class: expected 52, but was 53
[WARNING] Invalid bytecodeVersion for module-info.class: expected 52, but was 53
  • Loading branch information
jsoref committed Mar 18, 2019
1 parent b6b642b commit 992253b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ private String isBadArtifact( Artifact a )
jarFile = new JarFile( f );
getLog().debug( f.getName() + " => " + f.getPath() );
byte[] magicAndClassFileVersion = new byte[8];
StringBuilder artifactInfo = new StringBuilder();
artifactInfo.append( "(" ).append( a.getGroupId() ).append( ":" ).append( a.getArtifactId() ).append( ") " );
JAR: for ( Enumeration<JarEntry> e = jarFile.entries(); e.hasMoreElements(); )
{
JarEntry entry = e.nextElement();
Expand Down Expand Up @@ -324,7 +326,7 @@ private String isBadArtifact( Artifact a )

if ( MODULE_INFO_CLASS.equals( entry.getName() ) ) {
if ( major > maxJavaMajorVersionNumber ) {
getLog().warn("Invalid bytecodeVersion for " + MODULE_INFO_CLASS + ": expected "
getLog().warn( artifactInfo + "Invalid bytecodeVersion for " + MODULE_INFO_CLASS + ": expected "
+ maxJavaMajorVersionNumber + ", but was " + major);
}
}
Expand All @@ -334,7 +336,7 @@ else if ( matcher.matches() )

if ( major != expectedMajor )
{
getLog().warn( "Invalid bytecodeVersion for " + entry.getName() + ": expected "
getLog().warn( artifactInfo + "Invalid bytecodeVersion for " + entry.getName() + ": expected "
+ expectedMajor + ", but was " + major );
}
}
Expand Down

0 comments on commit 992253b

Please sign in to comment.