Maven子项目-无法解析的父POM [英] Maven Child Project- Non-resolvable parent POM

查看:20
本文介绍了Maven子项目-无法解析的父POM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将子项目转换为父项目(此子项目实际上并不依赖于父项目,因此我正在尝试将其设置为父项目,以便在Jenkins文件期间将其与另一个项目合并)。

我更改了POM文件的父节

<parent>
   <artifactId>org.springframework.boot</artifactId>
    <groupId>spring-boot-starter-parent</groupId>
    <version>1.2.5.RELEASE</version>
</parent>

但在生成时,我在Jenkins中收到以下错误。

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[[1;34mINFO[m] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/spring-boot-starter-parent/org.springframework.boot/1.2.5%20RELEASE/org.springframework.boot-1.2.5%20RELEASE.pom
[[1;31mERROR[m] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for demo-api:demo-api:1.0-SNAPSHOT: Could not find artifact spring-boot-starter-parent:org.springframework.boot:pom:1.2.5 RELEASE in central (https://repo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM @ line 5, column 13
 @ 
[[1;31mERROR[m] The build could not read 1 project -> [1m[Help 1][m
[[1;31mERROR[m]   
[[1;31mERROR[m]   The project demo-api:demo-api:1.0-SNAPSHOT (/home/estt/jenkins/workspace/demo-api-2/pom.xml) has 1 error
[[1;31mERROR[m]     Non-resolvable parent POM for demo-api:demo-api:1.0-SNAPSHOT: Could not find artifact spring-boot-starter-parent:org.springframework.boot:pom:1.2.5 RELEASE in central (https://repo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [1m[Help 2][m
[[1;31mERROR[m] 
[[1;31mERROR[m] To see the full stack trace of the errors, re-run Maven with the [1m-e[m switch.
[[1;31mERROR[m] Re-run Maven using the [1m-X[m switch to enable full debug logging.
[[1;31mERROR[m] 

这是完整的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">
    <parent>
       <artifactId>org.springframework.boot</artifactId>
        <groupId>spring-boot-starter-parent</groupId>
        <version>1.2.5.RELEASE</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <packaging>jar</packaging>

    <artifactId>demo-api</artifactId>
    <groupId>demo-api</groupId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
      <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>2.3.3</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <version>3.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>com.apiDemo.ApiApplication</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

推荐答案

您在父级中的groupID和artifactID颠倒了:

应为:

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.5.RELEASE</version>
    <relativePath/>
  </parent>

而不是

  <parent>
    <groupId>spring-boot-starter-parent</groupId>
    <artifactId>org.springframework.boot</artifactId>
    <version>1.2.5.RELEASE</version>
    <relativePath/>
  </parent>

这篇关于Maven子项目-无法解析的父POM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆