Reputation: 3265
I'm trying to run mvn -B org.apache.maven.plugins:maven-help-plugin:2.2:evaluate -Dexpression=project.version -Dartifact=com.acme:aggregator
on Maven 3.2.3
I don't understand why it's failing, especially that you can clearily see in the debug output that the project being processed is the one I have selected with the artifact
parameter.
In addition if I skip the artifact
parameter the build executes fine and I get the expected 0.0.1-SNAPSHOT
output, only with a No artifact parameter specified, using 'com.acme:aggregator:pom:0.0.1-SNAPSHOT' as project.
message.
Is this a bug?
07:03:36 [DEBUG] Configuring mojo org.apache.maven.plugins:maven-help-plugin:2.2:evaluate from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-help-plugin:2.2, parent: sun.misc.Launcher$AppClassLoader@55c4d594]
07:03:36 [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-help-plugin:2.2:evaluate' with basic configurator -->
07:03:36 [DEBUG] (f) artifact = com.acme:aggregator
07:03:36 [DEBUG] (f) expression = project.version
07:03:36 [DEBUG] (f) localRepository = id: local
07:03:36 url: file:///home/jenkins/.m2/repository/
07:03:36 layout: default
07:03:36 snapshots: [enabled => true, update => always]
07:03:36 releases: [enabled => true, update => always]
07:03:36
07:03:36 [DEBUG] (f) remoteRepositories = [ id: releases
07:03:36 url: https://mvnrepo.acme-it.com:5972/content/repositories/releases/
07:03:36 layout: default
07:03:36 snapshots: [enabled => false, update => daily]
07:03:36 releases: [enabled => true, update => daily]
07:03:36 , id: central
07:03:36 url: https://repo.maven.apache.org/maven2
07:03:36 layout: default
07:03:36 snapshots: [enabled => false, update => daily]
07:03:36 releases: [enabled => true, update => daily]
07:03:36 , id: thirdparty
07:03:36 url: https://mvnrepo.acme-it.com:5972/content/repositories/thirdparty
07:03:36 layout: default
07:03:36 snapshots: [enabled => false, update => daily]
07:03:36 releases: [enabled => true, update => never]
07:03:36 ]
07:03:36 [DEBUG] (f) project = MavenProject: com.acme:aggregator:0.0.1-SNAPSHOT @ /home/jenkins/workspace/Avalon_CFS_Tomcat_Functional_Tests_Java7/avalon/module/pom.xml
07:03:36 [DEBUG] (f) session = org.apache.maven.execution.MavenSession@49991717
07:03:36 [DEBUG] (f) settings = org.apache.maven.execution.SettingsAdapter@3f424360
07:03:36 [DEBUG] -- end configuration --
07:03:36 [DEBUG] Skipped remote update check for com.acme:aggregator/maven-metadata.xml, locally installed metadata up-to-date.
07:03:36 [DEBUG] Skipped remote update check for com.acme:aggregator/maven-metadata.xml, locally installed metadata up-to-date.
07:03:36 [DEBUG] Skipped remote update check for com.acme:aggregator/maven-metadata.xml, locally installed metadata up-to-date.
07:03:36 [INFO] ------------------------------------------------------------------------
07:03:36 [INFO] Reactor Summary:
07:03:36 [INFO]
07:03:36 [INFO] aggregator ......................................... FAILURE [ 1.104 s]
07:03:36 [INFO] ------------------------------------------------------------------------
07:03:36 [INFO] BUILD FAILURE
07:03:36 [INFO] ------------------------------------------------------------------------
07:03:36 [INFO] Total time: 3.285 s
07:03:36 [INFO] Finished at: 2015-11-02T07:03:36-08:00
07:03:36 [INFO] Final Memory: 18M/620M
07:03:36 [INFO] ------------------------------------------------------------------------
07:03:36 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-help-plugin:2.2:evaluate (default-cli) on project aggregator: Unable to get the POM for the artifact 'com.acme:aggregator'. Verify the artifact parameter. -> [Help 1]
07:03:36 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-help-plugin:2.2:evaluate (default-cli) on project aggregator: Unable to get the POM for the artifact 'com.acme:aggregator'. Verify the artifact parameter.
Upvotes: 1
Views: 2636
Reputation: 14762
I can confirm this behaviour.
If you specify the -Dartifact=...
parameter help:evaluate
apparently tries to find the given artifact on Maven's Central repository:
...
[INFO] --- maven-help-plugin:2.2:evaluate (default-cli) @ test ---
[INFO] Downloading: http://uk.maven.org/maven2/my/test/maven-metadata.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
...
It fails if it doesn't find it there.
Invoking just:
mvn help:evaluate -Dexpression=project.version
prints the info of the current POM, i.e. of the project in the directory of which you are currrently in.
Upvotes: 0