[英]Maven clean install failed to execute goal on project
I am developing a spring boot project which has few modules. 我正在开发一个具有很少模块的spring boot项目。 I have on entry point module which has main class, the other module dependencis i have added in entry point module pom.xml.
我在具有主类的入口点模块上有其他模块依赖项,我在入口点模块pom.xml中添加了它。 When i give command mvn clean install it throws an error saying `
当我给命令mvn clean install时,它抛出一个错误,提示`
Failed to execute goal on project api: Could not resolve dependencies for project com.nikesh:api:jar:1.0.0: The following artifacts could not be resolved: com.nikesh:lib:jar:1.0.0, com.nikesh:repo:jar:1.0.0, com.nikesh:entity:jar:1.0.0, com.nikesh:dto:jar:1.0.0, com.nikesh:service:jar:1.0.0, com.nikesh:common:jar:1.0.0: Failure to find com.nikesh:lib:jar:1.0.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -`
无法在项目api上执行目标:无法解析项目com.nikesh:api:jar:1.0.0的依赖项:无法解析以下工件:com.nikesh:lib:jar:1.0.0,com.nikesh: repo:jar:1.0.0,com.nikesh:entity:jar:1.0.0,com.nikesh:dto:jar:1.0.0,com.nikesh:service:jar:1.0.0,com.nikesh:common: jar:1.0.0:未能在https://repo.maven.apache.org/maven2中找到com.nikesh:lib:jar:1.0.0的本地存储库中已缓存,直到更新间隔才会重新尝试解析的中心已过去或强制进行更新-`
This is my pom.xml 这是我的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.nikesh</groupId>
<artifactId>api</artifactId>
<version>1.0.0</version>
<description>api module</description>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<start-class>com.nikesh.api.MultiModuleApp</start-class>
</properties>
<dependencies>
<dependency>
<groupId>com.nikesh</groupId>
<artifactId>lib</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.nikesh</groupId>
<artifactId>repo</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.nikesh</groupId>
<artifactId>entity</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.nikesh</groupId>
<artifactId>dto</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.nikesh</groupId>
<artifactId>service</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.nikesh</groupId>
<artifactId>common</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Please help me out resolving this issue. 请帮助我解决此问题。
You need to make sure that all sub modules are built in proper order before the main module build . 您需要确保在构建主模块之前按正确的顺序构建所有子模块 。
Guide to Working with Multiple Modules 使用多个模块的指南
The Reactor 反应堆
The mechanism in Maven that handles multi-module projects is referred to as the reactor. Maven中处理多模块项目的机制称为反应堆。 This part of the Maven core does the following:
Maven核心的这一部分执行以下操作:
Because modules within a multi-module build can depend on each other , it is important that The reactor sorts all the projects in a way that guarantees any project is built before it is required. 由于多模块构建中的模块可以相互依赖 ,因此重要的是,反应堆必须以确保在需要之前构建任何项目的方式对所有项目进行排序。
The following relationships are honoured when sorting projects: 对项目进行排序时,应遵循以下关系:
Note that only "instantiated" references are used - dependencyManagement
and pluginManagement
elements will not cause a change to the reactor sort order 请注意,只有“实例”引用用于-
dependencyManagement
和pluginManagement
元素不会引起变化到反应器中的排序顺序
for more info . 有关更多信息 。 You can refer this link for a sample multi module maven project.
您可以参考此链接获取示例多模块maven项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.