Maven 在命令行找不到 org.codehaus.mojo:exec-maven-plugin
Maven can't find org.codehaus.mojo:exec-maven-plugin at command line
我继承了一个孤立的 Java 8/Maven 项目,正在尝试构建。在自述文件中,我看到了 运行 以下命令的说明:
mvn -o -q -Dexec.executable="echo" -Dexec.args='${project.version}' org.codehaus.mojo:exec-maven-plugin:exec
当我 运行 形成我的项目根目录(其中包含 pom.xml
)时,我收到此错误:
[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
看起来它正在尝试使用 this plugin 通过 echo
打印 project.version
。
我想知道我需要做什么才能让它工作,听起来 Maven 在配置为查看的任何存储库中都找不到 org.codehaus.mojo:exec-maven-plugin
,但我做不到判断是否:
- 我需要向我的
pom.xml
添加另一个存储库配置;或
- 我需要在本地+手动安装
org.codehaus.mojo:exec-maven-plugin
以便Maven可以找到并执行它;或
- 还有其他事情发生
有什么想法吗?!
您指定 -o
作为 Maven 的参数。意思是"offline"。有了它你将无法下载依赖。
另请注意,您可以指定插件的版本以确保下载插件,因为您的实际错误显示:
Error resolving version for plugin
运行 独立目标不需要该版本,但您不调用独立目标。
所以试试像这样的东西:
mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}'
org.codehaus.mojo:exec-maven-plugin:1.6.0:exec
我继承了一个孤立的 Java 8/Maven 项目,正在尝试构建。在自述文件中,我看到了 运行 以下命令的说明:
mvn -o -q -Dexec.executable="echo" -Dexec.args='${project.version}' org.codehaus.mojo:exec-maven-plugin:exec
当我 运行 形成我的项目根目录(其中包含 pom.xml
)时,我收到此错误:
[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
看起来它正在尝试使用 this plugin 通过 echo
打印 project.version
。
我想知道我需要做什么才能让它工作,听起来 Maven 在配置为查看的任何存储库中都找不到 org.codehaus.mojo:exec-maven-plugin
,但我做不到判断是否:
- 我需要向我的
pom.xml
添加另一个存储库配置;或 - 我需要在本地+手动安装
org.codehaus.mojo:exec-maven-plugin
以便Maven可以找到并执行它;或 - 还有其他事情发生
有什么想法吗?!
您指定 -o
作为 Maven 的参数。意思是"offline"。有了它你将无法下载依赖。
另请注意,您可以指定插件的版本以确保下载插件,因为您的实际错误显示:
Error resolving version for plugin
运行 独立目标不需要该版本,但您不调用独立目标。
所以试试像这样的东西:
mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}'
org.codehaus.mojo:exec-maven-plugin:1.6.0:exec