enforceBytecodeVersion doesn't work with Java 11

72 views Asked by At

I have this configuration in my POM:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-enforcer-plugin</artifactId>
    <version>3.4.1</version> <!-- Trova l'ultima versione su http://maven.apache.org/plugins/maven-enforcer-plugin/ -->
    <executions>
        <execution>
            <id>enforce-bytecode-version</id>
            <goals>
                <goal>enforce</goal>
            </goals>
            <configuration>
                <rules>
                    <enforceBytecodeVersion>
                        <maxJdkVersion>11</maxJdkVersion>
                        <excludes>
                            <exclude>org.mindrot:jbcrypt</exclude>
                        </excludes>
                    </enforceBytecodeVersion>
                </rules>
                <fail>true</fail>
            </configuration>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>extra-enforcer-rules</artifactId>
            <version>1.0-beta-5</version>
        </dependency>
    </dependencies>
</plugin>

It gives me the error

Execution enforce-bytecode-version of goal org.apache.maven.plugins:maven-enforcer-plugin:3.4.1:enforce failed: Unknown JDK version given. Should be something like "1.7" -> [Help 1]

I haven't found any solution online to set Java 11.

1

There are 1 answers

0
Lore On BEST ANSWER

The solution was to update the dependency version

<dependency>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>extra-enforcer-rules</artifactId>
    <version>1.7.0</version>
</dependency>