簡體   English   中英

Maven無法建立pom

[英]Maven fails to build the pom

我從spring初始化程序中下載了spring項目,並通過maven將其導入到sts中。

不幸的是,構建不斷失敗,並出現以下錯誤:

項目生成錯誤:com.dellteam:firstmicroservice:0.0.1-SNAPSHOT的不可解析的父POM:無法傳輸
工件org.springframework.boot:spring-boot-starter-parent:pom:2.1.0.RELEASE從/到spring-milestones(https:// repo.spring.io/milestone):連接重置和'parent.relativePath'指向沒有本地POM的地方

請參閱下面的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>

我以為我的ISP不允許我訪問https://repo.spring.io/milestone/但事實並非如此。 我完全可以訪問此URL。

我現在嘗試清潔和構建幾次,並刪除了.m2文件夾,然后再次嘗試重新構建項目,但結果是相同的。

任何幫助將不勝感激。

將Spring Plugin Release Repo添加到Plugin-Repository。 這樣就可以找到spring-boot-maven-plugin-2.1.0.RELEASE。 將以下各行添加到標記下,如下所示:

<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>

有關更多信息,請檢查-> 找不到Spring Boot Starter Parent 2.0.0依賴項

您的互聯網連接有問題。 檢查是否需要配置代理服務器。 您可以在.m2目錄下的settings.xml中設置代理,選中此鏈接以配置代理。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM