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