我的多模块项目无法解析父依赖

时间:2021-04-08 20:30:59

标签: spring-boot maven build multi-module


我有一个多模块应用程序,
我需要从父模块导入一些类(它们对于所有模块都是相似的)
所以按照intellij的提示,我依赖于父模块
(这是我的第一个多模块应用程序)

问题是当我这样做时

mvn clean install -Dmaven.test.skip=true 

构建失败。
似乎maven正在从在线依赖中寻找我的父项目,显然它不存在,它应该在本地查找......我认为

实际上应用程序可以构建和运行,但我不能制作包,我不能安装它...

我该如何解决?
这是一些代码:

父级的 pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.4.3</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>eu.mrndesign.matned</groupId>
<artifactId>create-credit</artifactId>
<version>2.4.3</version>
<name>create-credit</name>
<description>Description</description>
<packaging>pom</packaging>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
</properties>

<modules>
    <module>client</module>
    <module>credit</module>
    <module>product</module>
</modules>

<dependencies>

        all are the same for children , so parent manages them...

</dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${project.parent.version}</version>
            </plugin>
        </plugins>
    </build>

</project>

其中一个孩子 pom(他们 3 岁,长得几乎一样):

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>eu.mrndesign.matned</groupId>
        <artifactId>create-credit</artifactId>
        <version>2.4.3</version>
    </parent>

    <artifactId>credit</artifactId>

    <name>credit</name>
    <description>Credit module for create-credit application</description>

    <properties>
        <java.version>11</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>eu.mrndesign.matned</groupId>
            <artifactId>create-credit</artifactId>
            <version>2.4.3</version>
        </dependency>
    </dependencies>

</project>

这是全新安装时的消息:

[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ create-credit ---
[INFO] Installing folders/create-credit/pom.xml to /root/.m2/repository/eu/mrndesign/matned/create-credit/2.4.3/create-credit-2.4.3.pom
[INFO] 
[INFO] ---------------------< eu.mrndesign.matned:client >---------------------
[INFO] Building client 2.4.3                                              [2/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for create-credit 2.4.3:
[INFO] 
[INFO] create-credit ...................................... SUCCESS [  0.820 s]
[INFO] client ............................................. FAILURE [  0.069 s]
[INFO] credit ............................................. SKIPPED
[INFO] product ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.116 s
[INFO] Finished at: 2021-04-08T22:13:30+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project client: Could not resolve dependencies for project eu.mrndesign.matned:client:jar:2.4.3: Failure to find eu.mrndesign.matned:create-credit:jar:2.4.3 in https://repo.spring.io/milestone was cached in the local repository, resolution will not be reattempted until the update interval of repository.spring.milestone has elapsed or updates are forced -> [Help 1]

0 个答案:

没有答案