简体   繁体   English

Maven全新安装无法在项目上执行目标

[英]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核心的这一部分执行以下操作:

  1. Collects all the available modules to build 收集所有可用模块以进行构建
  2. Sorts the projects into the correct build order 将项目分类为正确的构建顺序
  3. Builds the selected projects in order 按顺序构建所选项目

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: 对项目进行排序时,应遵循以下关系:

  • a project dependency on another module in the build 项目对构建中另一个模块的依赖
  • a plugin declaration where the plugin is another modules in the build 插件声明,其中插件是构建中的另一个模块
  • a plugin dependency on another module in the build 插件对构建中另一个模块的依赖
  • a build extension declaration on another module in the build 构建中另一个模块上的构建扩展声明
  • the order declared in the element (if no other rule applies) 元素中声明的顺序(如果没有其他规则适用)

Note that only "instantiated" references are used - dependencyManagement and pluginManagement elements will not cause a change to the reactor sort order 请注意,只有“实例”引用用于- dependencyManagementpluginManagement元素不会引起变化到反应器中的排序顺序

for more info . 有关更多信息 You can refer this link for a sample multi module maven project. 您可以参考此链接获取示例多模块maven项目。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 maven clean install - 无法在项目 myGoogleAppEngine 上执行目标 - maven clean install - Failed to execute goal on project myGoogleAppEngine maven:无法执行项目目标 - maven: Failed to execute goal on project 无法在Maven上执行项目目标 - Failed to execute goal on project on the maven 如何解决“无法在项目上执行目标 org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean)”? - How to solve "Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project"? 运行Maven项目的多个“实例”-无法执行目标org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean - Running multiple 'instances' of maven project - Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean Netbeans Maven 无法在项目上执行目标 - Netbeans Maven Failed to execute goal on project Maven 全新安装:无法执行目标 org.apache.maven.plugins:maven-resources-plugin:3.20。 - Maven clean install: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources Maven-无法执行目标 - Maven - Failed to execute goal Maven - 未能执行目标 org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean - Maven - Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean MAVEN 错误:“无法执行目标 org.apache.maven.plugins:maven-clean-plugin:3.2.0:clean” - MAVEN ERROR : "Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.2.0:clean "
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM