Hi Jörg, You will want to:
mvn help:evaluate -Dexpression=project.version -q -DforceStdout as prescribed in https://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html Cheers, Alexei On Monday, July 1, 2019 at 9:38:41 AM UTC+12, Jörg Hohwiller wrote: > > Hi there, > in order to determine the version(s) of a maven project, several answers > on stackoverflow, etc. lead to calling: > mvn -q exec:exec -Dexec.executable=echo -Dexec.args='${project.version}' > > However, if in case the maven project (or one of its modules) itself has > the maven-exec-plugin configured in its build section, the above command > fails. > For some reason here maven tries to invoke that exec-plugin execution as > well and ends up with some error like: > > [ERROR] Unknown lifecycle phase "1.0.0-beta1-SNAPSHOT". You must specify a > valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or > <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available > lifecycle phases are: validate, initialize, generate-sources, > process-sources, generate-resources, process-resources, compile, > process-classes, generate-test-sources, process-test-sources, > generate-test-resources, process-test-resources, test-compile, > process-test-classes, test, prepare-package, package, pre-integration-test, > integration-test, post-integration-test, verify, install, deploy, > pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> > [Help 1] > ... > [ERROR] Command execution failed. > org.apache.commons.exec.ExecuteException: Process exited with an error: 1 > (Exit value: 1) > at org.apache.commons.exec.DefaultExecutor.executeInternal > (DefaultExecutor.java:404) > at org.apache.commons.exec.DefaultExecutor.execute > (DefaultExecutor.java:166) > at org.codehaus.mojo.exec.ExecMojo.executeCommandLine > (ExecMojo.java:804) > > Is there some smart guy out there who could give me a hint how to avoid > this error (stop maven from executing the build execution of exec plugin > triggered from "mvn exec:exec" call)? > Or as an alternative give me a better hint how to determine the version of > the current maven project from bash without manually parsing > ./mvn/maven.config as well as pom.xml files, etc. ending up in > reimplementing maven... > > Thanks > Jörg > -- You received this message because you are subscribed to the Google Groups "mojohaus-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojohaus-dev+unsubscr...@googlegroups.com. To post to this group, send email to mojohaus-dev@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mojohaus-dev/65d8496f-90fe-4079-a4f0-9bb617dae775%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.