Maven 找不到依赖项:提示错误'parent.relativePath'点在错误的本地 POM

Posted

技术标签:

【中文标题】Maven 找不到依赖项:提示错误\'parent.relativePath\'点在错误的本地 POM【英文标题】:Maven Failed to Find dependency : prompt error of 'parent.relativePath' points at wrong local POMMaven 找不到依赖项:提示错误'parent.relativePath'点在错误的本地 POM 【发布时间】:2018-12-13 16:43:54 【问题描述】:

我是 Kotlin、Maven 和 SpringBoot 的新手。

我在尝试构建示例 kotlin 项目时遇到问题。我实际上确实添加了需要的外部 jar。我只是删掉了几行错误,因为另一个项目也有同样的错误。

[FATAL] Non-resolvable parent POM for com.jxinternet.platform:ms-common:1.0-SNAPSHOT: Failure to find com.jxinternet.platform:kotlin-starters:pom:1.0.1 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 and 'parent.relativePath' points at wrong local POM @ line 3, column 13
[WARNING] 'parent.relativePath' of POM com.jxinternet.platform:ms-account:1.0-SNAPSHOT (C:\Development File\eclipse-workspace\kotlin-starters\ms-account\pom.xml) points at com.jxinternet.platform:kotlin-starters instead of com.jxinternet.platform:dao-starters, please verify your project structure @ line 3, column 13
@ 
[ERROR] The build could not read 9 projects -> [Help 1]
[ERROR]   
[ERROR]   The project com.jxinternet.platform:ms-data:1.0-SNAPSHOT (C:\Development File\eclipse-workspace\kotlin-starters\ms-data\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.jxinternet.platform:ms-data:1.0-SNAPSHOT: Failure to find com.jxinternet.platform:kotlin-starters:pom:1.0.1 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 and 'parent.relativePath' points at wrong local POM @ line 3, column 13 -> [Help 2]
[ERROR]   

下面是我的构建配置。 * 我遵循一些 *** 的答案*

这是我的主要 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.jxinternet.platform</groupId>
    <artifactId>kotlin-starters</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>ms-parent</name>

    <modules>
        <module>otp</module>
        <module>ms-data</module>
        <module>ms-common</module>
        <module>ms-account</module>
        <module>ms-order</module>
        <module>ms-su-web</module>
        <module>ms-plugin-web</module>
        <module>ms-merchant-web</module>
        <module>ms-scheduled-task</module>
        <module>ms-payment-web</module>
        <!--<module>ms-test</module>-->
    </modules>

    <properties>
        <spring.boot.version>2.0.1.RELEASE</spring.boot.version>
        <spring.boot.redis.version>1.4.4.RELEASE</spring.boot.redis.version>
        <logback.verion>4.11</logback.verion>
    </properties>


    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>com.jxinternet.platform</groupId>
                <artifactId>otp</artifactId>
                <version>$project.version</version>
            </dependency>

            <!-- inner -->
            <dependency>
                <groupId>com.jxinternet.platform</groupId>
                <artifactId>ms-common</artifactId>
                <version>$project.version</version>
            </dependency>

            <dependency>
                <groupId>com.jxinternet.platform</groupId>
                <artifactId>ms-data</artifactId>
                <version>$project.version</version>
            </dependency>

            <dependency>
                <groupId>com.jxinternet.platform</groupId>
                <artifactId>ms-account</artifactId>
                <version>$project.version</version>
            </dependency>

            <dependency>
                <groupId>com.jxinternet.platform</groupId>
                <artifactId>ms-order</artifactId>
                <version>$project.version</version>
            </dependency>

            <!-- spring -->

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-redis</artifactId>
                <version>$spring.boot.redis.version</version>
            </dependency>

            <dependency>
                <groupId>net.logstash.logback</groupId>
                <artifactId>logstash-logback-encoder</artifactId>
                <version>$logback.verion</version>
            </dependency>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
                <version>$spring.boot.version</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-core</artifactId>
                <version>5.0.4.RELEASE</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <distributionManagement>
        <snapshotRepository>
            <id>nexus</id>
            <name>maven-snapshots</name>
            <url>http://192.168.1.25:8081/repository/maven-snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>nexus</id>
            <name>maven-releases</name>
            <url>http://192.168.1.25:8081/repository/maven-releases/</url>
        </repository>
    </distributionManagement>

</project>

我的一个孩子的绒球

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>kotlin-starters</artifactId>
        <groupId>com.jxinternet.platform</groupId>
        <version>1.0.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>ms-account</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>

    <dependencies>

        <!-- inner -->
        <dependency>
            <groupId>com.jxinternet.platform</groupId>
            <artifactId>ms-data</artifactId>
        </dependency>

        <dependency>
            <groupId>com.jxinternet.platform</groupId>
            <artifactId>ms-common</artifactId>
        </dependency>

        <dependency>
            <groupId>com.jxinternet.platform</groupId>
            <artifactId>otp</artifactId>
        </dependency>

        <!-- redis -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
        </dependency>

    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.jxinternet.platform</groupId>
                <artifactId>money-system-parent</artifactId>
                <version>$project.version</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>

伙计们,我是超级新手,我不知道是什么导致了错误,也不知道如何解决这个问题。我正在寻找 *** 的答案,有人说寻找我的 m2 文件夹。但我不知道要找什么……我输了。谢谢各位。

【问题讨论】:

默认情况下,您可以在您的用户文件夹中找到您的 .m2 目录。检查 maven_installed_dir\conf\setting.xml 中的设置,看看它是否在用户目录中找不到。 在我的 .m2 目录中只有存储库,没有 settings.xml。我在构建过程中遗漏了什么吗? 【参考方案1】:

您的父版本是1.0-SNAPSHOT,但在子pom.xmlms-data 您将父版本指定为1.0.1。应该是1.0-SNAPSHOT。还要检查所有其他的,以便父版本匹配。

【讨论】:

以上是关于Maven 找不到依赖项:提示错误'parent.relativePath'点在错误的本地 POM的主要内容,如果未能解决你的问题,请参考以下文章

Maven 在 IntelliJ 中找不到依赖项

找不到 Maven 依赖项的 Postgresql 驱动程序

Maven 找不到依赖项

找不到 Google API 使用地图的 Maven 依赖项

为啥 Intellij 在 pom.xml 中找不到任何 Maven 依赖项?

springboot项目打包时提示“程序包xxx不存在,找不到符号”