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 authored and slachiewicz committed Jul 31, 2021
1 parent 3829392 commit 5e34af0
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,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 @@ -351,7 +353,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 @@ -365,8 +367,8 @@ else if ( matcher.matches() )
}
else if ( major != expectedMajor )
{
getLog().warn( "Invalid bytecodeVersion for " + a + " : "
+ entry.getName() + ": expected " + expectedMajor + ", but was " + major );
getLog().warn( artifactInfo + "Invalid bytecodeVersion for " + entry.getName() + ": expected "
+ expectedMajor + ", but was " + major );
}
}
else
Expand Down

0 comments on commit 5e34af0

Please sign in to comment.