java - 如何解决 Maven 依赖项 "Failed to execute goal on project"的问题

标签 java eclipse maven jboss jetty

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

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

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

JBoss

现在,我想用另一个项目运行 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>

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

提前致谢

最佳答案

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

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

并不是说您每次运行 jetty:run 之前都必须运行 install。

另一种方法是使用eclipse,右击MyProject -> Run as -> Maven build...,在goals字段中输入-Djetty:port=8081 jetty:run并勾选“解决工作区 Artifact ”。

关于java - 如何解决 Maven 依赖项 "Failed to execute goal on project"的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22608350/

相关文章:

java - 通过 Firebase 在 Android 应用程序中进行身份验证 : Get the user’s first and last name

java - 打地鼠 - 线程中的 setButton

java - java延迟递归回溯

Eclipse CDT : don't print to screen until input first

java - Eclipse:如何手动安装 Eclipse Web 开发人员工具?

apache - 在 Windows 上构建 hadoop 2.2

java - 在java中,如何获取 slider 变化的值?

java - SWT - 当前平台

java - 为所有模块设置备用 JavaDoc 位置的最佳方法?

java - 使用 maven 插件部署 context.xml 文件