简体   繁体   中英

Maven fails to build the pom

I downloaded a spring project from the spring initializer and imported it in sts via maven.

Unfortunately, build keeps failing, with this error:

Project build error: Non-resolvable parent POM for com.dellteam:firstmicroservice:0.0.1-SNAPSHOT: Could not transfer
artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.0.RELEASE from/to spring-milestones (https:// repo.spring.io/milestone): Connection reset and 'parent.relativePath' points at no local POM

Please see below the 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.dellteam</groupId>
    <artifactId>firstmicroservice</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>firstmicroservice</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <spring-cloud.version>Greenwich.M1</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>


</project>

I thought my ISP is not allowing me to access https://repo.spring.io/milestone/ but that is not the case. This url is perfectly accessible to me.

I tried cleaning and building several times now and deleted .m2 folder and tried again rebuilding the project but the result is same.

Any help would be highly appreciated.

Add Spring Plugin Release Repo to Plugin-Repositories. So that it can find the spring-boot-maven-plugin-2.1.0.RELEASE. Add the below lines under tag as like:

<project>
  <!------ others lines -->
    <pluginRepositories>
     <pluginRepository>
        <id>repository.spring.release</id>
        <name>Spring GA Repository</name>
        <url>https://repo.spring.io/plugins-release/</url>
    </pluginRepository>
   </pluginRepositories>
 </project>

For more info check --> Spring boot starter parent 2.0.0 not found dependency

Its an issue with your internet connection. Check if you need to configure a proxy server. You can set the proxies in settings.xml under your .m2 directory, check This link for configuring proxy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM