简体   繁体   English

Maven在命令行找不到org.codehaus.mojo:exec-maven-plugin

[英]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. 我继承了一个孤立的Java 8 / Maven项目,并试图确定其构建方式。 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: 当我从我的项目根目录(包含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

Looks like it's trying to use this plugin to print the project.version via echo . 看起来它正在尝试使用此插件通过echo打印project.version

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: 我想知道我需要做些什么才能使它工作,听起来Maven只是无法在配置为查找的任何存储库中找到org.codehaus.mojo:exec-maven-plugin ,但是我可以不知道是否:

  1. I need to add another repository configuration to my pom.xml ; 我需要在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; 我需要在本地+手动安装org.codehaus.mojo:exec-maven-plugin以便Maven可以找到并执行它; or 要么
  3. Something else is going on 发生了其他事情

Any ideas?! 有任何想法吗?!

You specify -o as argument to Maven. 您将-o指定为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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Maven错误:无法执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - Maven error: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec Java POM 插件问题(无法解析 mojo org.codehaus.mojo:exec-maven-plugin 的配置) - Java POM plugin issue (Unable to parse configuration of mojo org.codehaus.mojo:exec-maven-plugin) Maven 不会运行我的项目:无法执行目标 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - Maven won't run my Project : Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec 无法在项目上执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec(default-cli):命令执行失败 - Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project: Command execution failed Eclipse:无法执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec(默认值):命令执行失败 - Eclipse: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default): Command execution failed Maven无法执行目标org.codehaus.mojo:exec-maven-plugin:1.3 - Maven Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3 Smooks-无法执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - Smooks - Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec 为什么我会遇到 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec 错误? - Why am I running into org.codehaus.mojo:exec-maven-plugin:1.2.1:exec error? 无法执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec( - Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec ( 无法执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM