0

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.

Zsolt
  • 470
  • 4
  • 8
  • Do you by chance have a `build-release-8` in your project? This has been fixed in the jboss-parent 37. – James R. Perkins Nov 16 '20 at 21:55
  • No I don't have. How can I switch to jboss-parent 37 if the jboss-eap-jakartaee8-with-tools dependency uses 35? – Zsolt Nov 17 '20 at 14:01
  • I'm not sure you can. However I tested some quickstarts and I don't seem to have the issue. Do you have a way to reproduce the error? – James R. Perkins Nov 17 '20 at 15:53
  • Thanks for your help. I just found out the answer. I posted the explanation. TL:DR: ant plugin used built-in older version of maven, failing to parse pom.xml file with given version range in it. – Zsolt Nov 17 '20 at 18:34
  • Ah yes. I do recall that's how that issue came up now. – James R. Perkins Nov 18 '20 at 00:40

2 Answers2

1

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.

Zsolt
  • 470
  • 4
  • 8
0

You should migrate from Maven Ant Tasks to Maven Artifact Resolver Ant Tasks. That should solve the "open versions" problem and it doesn't bundle maven in jar aswell.

It has a bug with proxy-repositories tho.. made it for us stepping from one problem into another one, like described here :/

aexellent
  • 145
  • 9