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

Failed to enforce bytecode version with JAR which contain module-info.class #46

Closed
khmarbaise opened this issue Mar 3, 2018 · 3 comments

Comments

@khmarbaise
Copy link
Member

khmarbaise commented Mar 3, 2018

Need to think about this situation?

maven-help-plugin in commit without the upgrade to parent 31 it works after upgrade it fails with the following messages:

[windows-jdk7] [INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1.jar (38 kB at 189 kB/s)
[windows-jdk7] [INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar
[windows-jdk7] [INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.19.1/surefire-booter-2.19.1.jar (46 kB at 225 kB/s)
[windows-jdk7] [INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.19.1/maven-surefire-common-2.19.1.jar (293 kB at 1.4 MB/s)
[windows-jdk7] [INFO] Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar (243 kB at 1.2 MB/s)
[windows-jdk7] [INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.19.1/surefire-api-2.19.1.jar (196 kB at 952 kB/s)
[windows-jdk7] [INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar (316 kB at 1.4 MB/s)
[windows-jdk7] [INFO] Using 'UTF-8' encoding to read mojo source files.
[windows-jdk9] [INFO] Restricted to JDK 1.7 yet org.ow2.asm:asm:jar:6.0_ALPHA:compile contains module-info.class targeted to JDK 1.9
[windows-jdk9] [INFO] Restricted to JDK 1.7 yet org.ow2.asm:asm-tree:jar:6.0_ALPHA:compile contains module-info.class targeted to JDK 1.9
[windows-jdk9] [INFO] Restricted to JDK 1.7 yet org.ow2.asm:asm-commons:jar:6.0_ALPHA:compile contains module-info.class targeted to JDK 1.9
[windows-jdk9] [WARNING] Rule 0: org.apache.maven.plugins.enforcer.EnforceBytecodeVersion failed with message:
[windows-jdk9] Found Banned Dependency: org.ow2.asm:asm:jar:6.0_ALPHA
[windows-jdk9] Found Banned Dependency: org.ow2.asm:asm-tree:jar:6.0_ALPHA
[windows-jdk9] Found Banned Dependency: org.ow2.asm:asm-commons:jar:6.0_ALPHA
[windows-jdk9] Use 'mvn dependency:tree' to locate the source of the banned dependencies.

The question is if we take module-info.class as violation for byte code version into account?

@gmshake
Copy link

gmshake commented May 15, 2018

Workaround, ignore module-info.class in enforceBytecodeVersion rule config.

<plugin>
	<artifactId>maven-enforcer-plugin</artifactId>
	<executions>
		<execution>
			<id>enforce-bytecode-version</id>
			<goals>
				<goal>enforce</goal>
			</goals>
			<configuration>
				<rules>
					<enforceBytecodeVersion>
						<maxJdkVersion>1.7</maxJdkVersion>
						<ignoreClasses>
							<ignoreClass>module-info</ignoreClass>
						</ignoreClasses>
					</enforceBytecodeVersion>
				</rules>
			</configuration>
		</execution>
	</executions>
	<dependencies>
		<dependency>
			<groupId>org.codehaus.mojo</groupId>
			<artifactId>extra-enforcer-rules</artifactId>
			<version>1.0-beta-7</version>
		</dependency>
	</dependencies>
</plugin>

@seanf
Copy link

seanf commented Jun 21, 2018

Is this covered by #36 ?

Vlatombe added a commit to Vlatombe/extra-enforcer-rules that referenced this issue Mar 20, 2019
darxriggs added a commit to darxriggs/jacoco-plugin that referenced this issue Nov 3, 2019
It was originally introduced because the ASM jar files contain a
module-info.class which is targeted to Java 9. When using JDK 8
for building the enforcer therefore complained.

The current parent pom uses the newer extra-enforcer-rules 1.2
which ignores the module-info.class in case a JDK < 9 is used.

For more details see
- mojohaus/extra-enforcer-rules#33
- mojohaus/extra-enforcer-rules#46
@mfriedenhagen mfriedenhagen removed this from the 1.0.0 milestone Jun 29, 2020
@slawekjaranowski
Copy link
Member

Does #76 resolve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants