【问题标题】:How to resolve issue with Maven dependencies "Failed to execute goal on project"如何解决 Maven 依赖项“无法在项目上执行目标”的问题
【发布时间】:2014-03-24 11:39:14
【问题描述】:

我在我的 maven 项目的 Eclipse 中有以下结构:

MainMavenProject
---MyProject
---MProject-client
---MProject-xyz
---MProject-web
...

在 Eclipse 中,我使用 JBoss 7.1 来运行 MProject-web:

现在,我想在另一个项目中运行 Jetty。从目录 /MainMavenProject/MyProject 我运行一个命令

mvn -Djetty:port=8081 jetty:run

它已经完成了一个错误:

[ERROR] Failed to execute goal on project MyProject: Could not resolve dependencies for project ***.*****.MyProject:MyProject:war:0.0.1-SNAPSHOT: The following artifacts could not be resolved: ***.*****.********:MyProject-client:jar:1.0.
1-SNAPSHOT, com.*****.********:MProject-xyz:jar:1.0.1-SNAPSHOT: Failure to find ***.*****.********:MyProject-client:jar:1.0.1-SNAPSHOT in https://*********.*****.com/nexus/content/groups/development was cached in the local repository, resolutio
n will not be reattempted until the update interval of *****-central has elapsed or updates are forced -> [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/DependencyResolutionException

在 MyProject 中,我使用其他依赖项:

<dependency>
    <groupId>com.*****.********</groupId>
    <artifactId>MyProject-client/artifactId>
    <version>1.0.1-SNAPSHOT</version>
</dependency>

<dependency>
    <groupId>com.*****.********</groupId>
    <artifactId>MProject-xyz</artifactId>
    <version>1.0.1-SNAPSHOT</version>
</dependency>

我如何检查,究竟发生了什么,之后如何解决?

提前谢谢你

【问题讨论】:

    标签: java eclipse maven jboss jetty


    【解决方案1】:

    先尝试在主项目上运行mvn install

    您的项目缺少其他模块,这些模块可能从未安装到本地存储库。

    并不是每次运行jetty:run之前都必须运行安装。

    另一种方法是使用 eclipse,右键单击 MyProject -> Run as -> Maven build...,在目标字段中输入 -Djetty:port=8081 jetty:run 并选中“Resolve workspace artifacts”。

    【讨论】:

    • 嗨,我做了 mvn clean,但我仍然遇到同样的问题。我更喜欢在命令行中使用 jetty。我可以不从 Eclipse 运行 Resolve workspace artifiacts 吗?
    • @IWillTryToCodeIt 不(至少没有一些非常肮脏的技巧)。从 主项目 执行 mvn clean install。有用吗?
    猜你喜欢
    • 2014-08-31
    • 2013-07-01
    • 1970-01-01
    • 2014-09-05
    • 1970-01-01
    • 2021-08-24
    • 1970-01-01
    • 1970-01-01
    • 2017-03-03
    相关资源
    最近更新 更多