如何解决与Maven依赖关系的问题“未能实现项目的目标”

时间:2022-09-03 22:56:41

I have got the following structure in Eclipse of my maven projects:

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

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

In Eclipse, I use JBoss 7.1 to run MProject-web:

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

如何解决与Maven依赖关系的问题“未能实现项目的目标”

Now, I want to run Jetty with another project. From directory /MainMavenProject/MyProject I run a command

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

mvn -Djetty:port=8081 jetty:run

It has been finished with an error:

完成时出现了一个错误:

[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

In MyProject, I use depedencies to the other ones:

在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>

How can I check, what exactly happend and after that, how to fix it?

我怎么能检查,到底发生了什么,之后又如何修复?

Thank you in advance

提前谢谢你

1 个解决方案

#1


5  

Try running mvn install on the Main project first.

首先尝试在主项目上运行mvn安装。

Your project is missing the other modules, which likely have never been installed to local repository.

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

Not that you would have to run install every time before running jetty:run.

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

An alternative would be to use the eclipse, right click MyProject -> Run as -> Maven build..., enter -Djetty:port=8081 jetty:run in the goals field and check "Resolve workspace artifacts".

另一种选择是使用eclipse,右键单击MyProject ->作为-> Maven构建运行…, enter -Djetty:port=8081 jetty:在goals字段中运行并检查“Resolve workspace artifacts”。

#1


5  

Try running mvn install on the Main project first.

首先尝试在主项目上运行mvn安装。

Your project is missing the other modules, which likely have never been installed to local repository.

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

Not that you would have to run install every time before running jetty:run.

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

An alternative would be to use the eclipse, right click MyProject -> Run as -> Maven build..., enter -Djetty:port=8081 jetty:run in the goals field and check "Resolve workspace artifacts".

另一种选择是使用eclipse,右键单击MyProject ->作为-> Maven构建运行…, enter -Djetty:port=8081 jetty:在goals字段中运行并检查“Resolve workspace artifacts”。