Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven can't find org.codehaus.mojo:exec-maven-plugin at command line

I inherited an orphaned Java 8/Maven project and am trying to figure the build out. In the README I see instructions to run the following command:

mvn -o -q -Dexec.executable="echo" -Dexec.args='${project.version}' org.codehaus.mojo:exec-maven-plugin:exec

When I run that form my project root (which contains pom.xml) I get this error:

[ERROR] Error resolving version for plugin 'org.codehaus.mojo:exec-maven-plugin' from the repositories [local (/Users/myuser/.m2/repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginVersionResolutionException

Looks like it's trying to use this plugin to print the project.version via echo.

I'm wondering what I need to do so that this works, it sounds like Maven just can't find org.codehaus.mojo:exec-maven-plugin in any of the repos its been configured to look in, but I can't tell whether:

  1. I need to add another repository configuration to my pom.xml; or
  2. I need to install org.codehaus.mojo:exec-maven-plugin somewhere locally + manually so that Maven can find it and execute it; or
  3. Something else is going on

Any ideas?!

like image 292
hotmeatballsoup Avatar asked Mar 07 '23 00:03

hotmeatballsoup


1 Answers

You specify -o as argument to Maven. It means "offline". With it you will not be able to download the dependency.
Note also that you could specify the version of the plugin to ensure that the plugin be downloaded because your actual errors says :

Error resolving version for plugin

The version is not required to run a standalone goal but you don't invoke a standalone goal.

So try something like :

 mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}'
 org.codehaus.mojo:exec-maven-plugin:1.6.0:exec
like image 80
davidxxx Avatar answered Mar 17 '23 17:03

davidxxx