We’re migrating a java application from JBoss EAP 6 to JBoss EAP 7.3. We updated the jboss BOM files to the Jakarta EE 8 version:
<dependency> <groupId>org.jboss.bom</groupId> <artifactId>jboss-eap-jakartaee8-with-tools</artifactId> <version>${version.jboss.bom}</version> <type>pom</type> <scope>import</scope> </dependency>
Upon building our final EAR file, the maven build fails with the following error:
Unable to initialize POM pom.xml: Invalid JDK version in profile 'compile-java8-release-flag': Unbounded range: [9, for project org.jboss:jboss-parent at org.apache.maven.artifact.ant.Pom.initialiseMavenProject(Pom.java:217) at org.apache.maven.artifact.ant.Pom.doExecute(Pom.java:418) at org.apache.maven.artifact.ant.AbstractArtifactTask.execute(AbstractArtifactTask.java:751) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:435) at org.apache.tools.ant.Target.performTasks(Target.java:456) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393) at org.apache.tools.ant.Project.executeTarget(Project.java:1364) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1248) at org.apache.tools.ant.Main.runBuild(Main.java:851) at org.apache.tools.ant.Main.startAnt(Main.java:235) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Caused by: org.apache.maven.project.ProjectBuildingException: Invalid JDK version in profile 'compile-java8-release-flag': Unbounded range: [9, for project org.jboss:jboss-parent at org.apache.maven.project.DefaultMavenProjectBuilder.injectActiveProfiles(DefaultMavenProjectBuilder.java:1502) at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1194) at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1407) at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1407) at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:823) at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:255) at org.apache.maven.project.DefaultMavenProjectBuilder.mergeManagedDependencies(DefaultMavenProjectBuilder.java:1456) at org.apache.maven.project.DefaultMavenProjectBuilder.processProjectLogic(DefaultMavenProjectBuilder.java:999) at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:880) at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:508) at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200) at org.apache.maven.artifact.ant.Pom.initialiseMavenProject(Pom.java:211) ... 18 more Caused by: org.apache.maven.profiles.activation.ProfileActivationException: Invalid JDK version in profile 'compile-java8-release-flag': Unbounded range: [9, at org.apache.maven.profiles.activation.JdkPrefixProfileActivator.isActive(JdkPrefixProfileActivator.java:57) at org.apache.maven.profiles.DefaultProfileManager.isActive(DefaultProfileManager.java:273) at org.apache.maven.profiles.DefaultProfileManager.getActiveProfiles(DefaultProfileManager.java:209) at org.apache.maven.project.DefaultMavenProjectBuilder.injectActiveProfiles(DefaultMavenProjectBuilder.java:1496) ... 29 more
We found that the bom we included uses org.jboss.jboss-parent as parent and it contains the following profile:
<profile> <id>compile-java8-release-flag</id> <activation> <file> <exists>${basedir}/build-release-8</exists> </file> <jdk>[9,</jdk> </activation> <!-- ... --> </profile>
In the jdk tag the version is missing a ) character from the end. There is a newer version of jboss-eap-jakartaee8-with-tools which still uses the jboss-parent:35 so it produces this very same error.
There is no relevant discussion about this topic. Also there exists a jboss-parent with version 36 with fixes this issue however it’s not used in any of the boms. There is no mention of this issue in the official redhat maven repository incremental updates nor in the eap 7.3 updates.
How to fix this issue beside manually editing the jboss-parent in the local maven repository? Is there an official fix for this?
Thank you.
Advertisement
Answer
TL;DR explanation Forgotten plugin in ant pulled a joke on us. We need to update the plugin or ant alltogether.
Longer explanation: So the project we are migrating is old. It uses Ant 1.9.1 and Maven 3.0.5 simultaneously. As it turns out, at one point in the build.xml Ant 1.9.1 uses the Maven Ant Task plugin which comes with its own Maven 2.2.1 in its plugin jar. Before migration everything was working fine between the build automation tools. After migration there was a version range defined in the new dependencies which was fine with Maven 3.x but Maven 2.x died. We mistakenly identified that Maven 3.x causes the problem, but no.