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

Archetype fails on maven version detection on some Linux distributions #2102

Closed
tomas-langer opened this issue Jun 26, 2020 · 2 comments
Closed
Assignees
Labels
archetypes bug Something isn't working
Milestone

Comments

@tomas-langer
Copy link
Member

Environment Details

  • Helidon Version: 2.0.0
  • JDK version: OpenJDK 14
  • OS: Linux
  • Maven 3.6.3

The maven core library is called maven-core-3.x.jar. Our detection mechanism in Groovy script expects it to have full version.
The detection mechanism fails and reports the version is not good enough:

Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate (default-cli) on project standalone-pom: Requires Maven >= 3.2.5 -> [Help 1]

We should change our version detection mechanism to work for such scenarios (or accept "unknown" maven versions instead of failing).

@tomas-langer tomas-langer added bug Something isn't working archetypes labels Jun 26, 2020
@gargoyle
Copy link

I'm not sure where the groovy script lives and I'm a bit of a groovy novice, but perhaps something like this could be used to reach inside the .jar and pull the value directly from the manifest instead of relying on the filename?

(Note, Crude adaption of the code you pasted in Slack)

def mavenCoreJar = mavenLibDir.list().find { it.startsWith("maven-core-") }
        if (mavenCoreJar == null) {
            throw new IllegalStateException("Unable to determine Maven version")
        }
        String mavenVersion = new java.util.jar.JarFile(mavenCoreJar).manifest.mainAttributes.getValue("Implementation-Version");
        ComparableVersion minMavenVersion = new ComparableVersion("3.2.5")
        if (new ComparableVersion(mavenVersion) < minMavenVersion) {
            throw new IllegalStateException("Requires Maven >= 3.2.5")
        }

@barchetta
Copy link
Member

barchetta commented Jun 26, 2020

This looks like an issue when maven is install via a Linux package (as opposed to direct maven download). For example: https://packages.ubuntu.com/eoan/all/libmaven3-core-java/filelist

A work-around is to install maven directly from Apache: https://maven.apache.org/download.cgi

Poking around Linux distributions I've seen maven-core.jar, maven-core-3.x.jar, maven-core-<fullversion>.jar

@barchetta barchetta changed the title Archetype fails on maven version detection Archetype fails on maven version detection on some Linux distributions Jun 26, 2020
@romain-grecourt romain-grecourt self-assigned this Jun 26, 2020
@barchetta barchetta added this to the 2.0.1 milestone Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archetypes bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

4 participants