Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/383.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Maven can';在命令行中找不到org.codehaus.mojo:execmaven插件_Java_Maven_Maven Plugin - Fatal编程技术网

Java Maven can';在命令行中找不到org.codehaus.mojo:execmaven插件

Java Maven can';在命令行中找不到org.codehaus.mojo:execmaven插件,java,maven,maven-plugin,Java,Maven,Maven Plugin,我继承了一个孤立的Java8/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

我继承了一个孤立的Java8/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
看起来它正试图通过
echo
打印
项目版本

我想知道我需要做些什么才能让它起作用,听起来Maven在任何回购协议中都找不到
org.codehaus.mojo:exec Maven plugin
,但我不知道是否:

  • 我需要将另一个存储库配置添加到我的
    pom.xml
    ;或
  • 我需要在本地+手动的地方安装
    org.codehaus.mojo:exec-maven-plugin
    ,以便maven可以找到并执行它;或
  • 还有别的事

  • 有什么想法吗

    指定
    -o
    作为Maven的参数。意思是“离线”。使用它,您将无法下载依赖项。
    还请注意,您可以指定插件的版本,以确保插件可以下载,因为您的实际错误显示:

    解析插件的版本时出错

    运行独立目标不需要该版本,但您不调用独立目标

    因此,请尝试以下方法:

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