qoomon / maven-git-versioning-extension

This extension will set project version, based on current Git branch or tag.
GNU General Public License v3.0
305 stars 87 forks source link

The extension fails using maven `v3.9.8` #315

Closed ralfkonrad closed 5 months ago

ralfkonrad commented 5 months ago

We get an exception when using maven v3.9.8:

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils

Looking at the maven lib directory it is obvious that maven has removed ~(or forgotten?)~ the dependency org.apache.commons:commons-lang3 upgrading from v3.9.7 to v3.9.8.

The error occurs for both mvn and mvnw on Windows and Ubuntu.


[INFO] --- me.qoomon:maven-git-versioning-extension:9.8.0 [core extension] ----
[INFO] matching ref: BRANCH - bugfix/maven-v3.9.8_vs_versioning-extension
[INFO] ref configuration: BRANCH - pattern: .+
[INFO]   describeTagFirstParent: true
[INFO]   version: ${commit.timestamp.year}${commit.timestamp.month}${commit.timestamp.day}${commit.timestamp.hour}${commit.timestamp.minute}${commit.timestamp.second}.0.0+${commit.short}
[INFO]
[INFO] com.smarttrade:smarttrade
---------------------------------------------------
constituent[0]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/conf/logging/
constituent[1]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/aopalliance-1.0.jar
constituent[2]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/commons-cli-1.8.0.jar
constituent[3]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/commons-codec-1.16.1.jar
constituent[4]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/failureaccess-1.0.2.jar
constituent[5]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/guava-33.2.1-jre.jar
constituent[6]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/guice-5.1.0.jar
constituent[7]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/httpclient-4.5.14.jar
constituent[8]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/httpcore-4.4.16.jar
constituent[9]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/jansi-2.4.1.jar
constituent[10]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/javax.annotation-api-1.3.2.jar
constituent[11]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/javax.inject-1.jar
constituent[12]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/jcl-over-slf4j-1.7.36.jar
constituent[13]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-artifact-3.9.8.jar
constituent[14]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-builder-support-3.9.8.jar
constituent[15]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-compat-3.9.8.jar
constituent[16]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-core-3.9.8.jar
constituent[17]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-embedder-3.9.8.jar
constituent[18]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-model-3.9.8.jar
constituent[19]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-model-builder-3.9.8.jar
constituent[20]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-plugin-api-3.9.8.jar
constituent[21]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-repository-metadata-3.9.8.jar
constituent[22]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-resolver-api-1.9.20.jar
constituent[23]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-resolver-connector-basic-1.9.20.jar
constituent[24]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-resolver-impl-1.9.20.jar
constituent[25]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-resolver-named-locks-1.9.20.jar
constituent[26]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-resolver-provider-3.9.8.jar
constituent[27]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-resolver-spi-1.9.20.jar
constituent[28]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-resolver-transport-file-1.9.20.jar
constituent[29]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-resolver-transport-http-1.9.20.jar
constituent[30]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-resolver-transport-wagon-1.9.20.jar
constituent[31]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-resolver-util-1.9.20.jar
constituent[32]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-settings-3.9.8.jar
constituent[33]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-settings-builder-3.9.8.jar
constituent[34]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-shared-utils-3.4.2.jar
constituent[35]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/maven-slf4j-provider-3.9.8.jar
constituent[36]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/org.eclipse.sisu.inject-0.9.0.M3.jar
constituent[37]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/org.eclipse.sisu.plexus-0.9.0.M3.jar
constituent[38]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/plexus-cipher-2.0.jar
constituent[39]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/plexus-component-annotations-2.1.0.jar
constituent[40]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/plexus-interpolation-1.27.jar
constituent[41]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/plexus-sec-dispatcher-2.0.jar
constituent[42]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/plexus-utils-3.5.1.jar
constituent[43]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/plexus-xml-3.0.0.jar
constituent[44]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/slf4j-api-1.7.36.jar
constituent[45]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/wagon-file-3.5.3.jar
constituent[46]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/wagon-http-3.5.3.jar
constituent[47]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/wagon-http-shared-3.5.3.jar
constituent[48]: file:/home/ralf/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8/lib/wagon-provider-api-3.5.3.jar
---------------------------------------------------
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:52)
        at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:73)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
        at me.qoomon.maven.gitversioning.GitVersioningModelProcessor.lambda$generateGlobalFormatPlaceholderMap$30(GitVersioningModelProcessor.java:897)
        at me.qoomon.gitversioning.commons.Lazy.get(Lazy.java:22)
        at me.qoomon.gitversioning.commons.StringUtil.substituteText(StringUtil.java:20)
        at me.qoomon.maven.gitversioning.GitVersioningModelProcessor.getGitVersion(GitVersioningModelProcessor.java:829)
        at me.qoomon.maven.gitversioning.GitVersioningModelProcessor.updateVersion(GitVersioningModelProcessor.java:403)
        at me.qoomon.maven.gitversioning.GitVersioningModelProcessor.updateModel(GitVersioningModelProcessor.java:351)
        at me.qoomon.maven.gitversioning.GitVersioningModelProcessor.processModel(GitVersioningModelProcessor.java:322)
        at me.qoomon.maven.gitversioning.GitVersioningModelProcessor.read(GitVersioningModelProcessor.java:139)
        at org.apache.maven.model.building.DefaultModelBuilder.readModel(DefaultModelBuilder.java:593)
        at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:261)
        at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:247)
        at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:447)
        at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:410)
        at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:367)
        at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:349)
        at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:340)
        at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:76)
        at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:448)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:197)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:903)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:280)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
        ... 7 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:225)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:210)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:205)
        ... 39 more
djarnis73 commented 5 months ago

From maven 3.9.8 release notes:

Finally, Maven 3.9.8 went thru a “diet”, and lost commons-lang from it's constituents. This change has no effect on plugins (as commons-lang was never published artifact by Core), while extensions, that do depend on presence of it hopefully did declare it as dependency (as would be best practice).

qoomon commented 5 months ago

I'll release a fix today

qoomon commented 5 months ago

Feel free to try version 9.8.1

ralfkonrad commented 5 months ago

Feel free to try version 9.8.1

Thanks for the quick fix. It works as expected. 👍