Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-13535

Fix maven-enforcer-plugin to require JDK 11

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • Minor
    • 14.0.0.Dev01
    • 13.0.0.Final, 13.0.1.Final, 13.0.2.Final
    • Build
    • None

    Description

      Currently, the maven-enforcer-plugin still effectively requires JDK 1.8. Building with JDK 8 then fails in runtime:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project infinispan-component-annotations: Fatal error compiling: invalid flag: --release -> [Help 1]
      

      while the desired outcome is the following enforcer message:

      [INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-java-version) @ infinispan-build-configuration-parent ---
      [WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
      To build this project JDK 11 (or greater) is required. Please install it.
      ...
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce (enforce-java-version) on project infinispan-build-configuration-parent: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
      

      This is because the resulting enforcer setup looks like this in effective pom:

       <plugin>
              <artifactId>maven-enforcer-plugin</artifactId>
              <version>3.0.0-M1</version>
              <executions>
                <execution>
                  <id>enforce-java-version</id>
                  <goals>
                    <goal>enforce</goal>
                  </goals>
                  <configuration>
                    <rules>
                      <bannedRepositories>
                        <level>ERROR</level>
                        <bannedRepositories>
                          <bannedRepository>http://*</bannedRepository>
                        </bannedRepositories>
                        <bannedPluginRepositories>
                          <bannedPluginRepository>http://*</bannedPluginRepository>
                        </bannedPluginRepositories>
                      </bannedRepositories>
                      <requireJavaVersion>
                        <message>To build this project JDK 1.8 (or greater) is required. Please install it.</message>
                        <version>1.8</version>
                      </requireJavaVersion>
                    </rules>
                  </configuration>
                </execution>
                <execution>
                  <id>enforce-maven-version</id>
                  <goals>
                    <goal>enforce</goal>
                  </goals>
                  <configuration>
                    <rules>
                      <requireMavenVersion>
                        <message>To build this project Maven 3.2.5 (or greater) is required. Please install it.</message>
                        <version>3.2.5</version>
                      </requireMavenVersion>
                    </rules>
                  </configuration>
                </execution>
                <execution>
                  <id>enforce-java</id>
                  <goals>
                    <goal>enforce</goal>
                  </goals>
                  <configuration>
                    <rules>
                      <requireJavaVersion>
                        <version>[11,)</version>
                      </requireJavaVersion>
                      <requireMavenVersion>
                        <version>[3.2.1,)</version>
                      </requireMavenVersion>
                    </rules>
                  </configuration>
                </execution>
              </executions>
            </plugin>
      

      also, that's the effective pom of the parent, while other modules' parent is the build-configuration one.

      There doesn't seem to be a reason not to just use the jboss-parent to do this which requires configuring maven.min.version and jdk.min.version.

      Attachments

        Activity

          People

            rhn-engineering-rhusar Radoslav Husar
            rhn-engineering-rhusar Radoslav Husar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: