简体   繁体   中英

Non-resolvable parent POM: Could not transfer artifact org.springframework.boot:spring-boot-dependencies:pom

this is my pom.xml where i copied from here

<groupId>com.example</groupId>
<artifactId>myproject</artifactId>
<version>0.0.1-SNAPSHOT</version>

<dependencyManagement>
<dependencies>
    <!-- Override Spring Data release train provided by Spring Boot -->
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-releasetrain</artifactId>
        <version>Fowler-SR2</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.1.0.BUILD-SNAPSHOT</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
</dependencies>

<!-- Additional lines to be added here... -->

<!-- (you don't need this if you are using a .RELEASE version) -->
<repositories>
    <repository>
        <id>spring-snapshots</id>
        <url>https://repo.spring.io/snapshot</url>
        <snapshots><enabled>true</enabled></snapshots>
    </repository>
    <repository>
        <id>spring-milestones</id>
        <url>https://repo.spring.io/milestone</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <url>https://repo.spring.io/snapshot</url>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <url>https://repo.spring.io/milestone</url>
    </pluginRepository>
</pluginRepositories>

when i write mvn package in command line i get the following error:

Non-resolvable import POM:could not transfer artifact org.springframework.boot:spring-boot-dependencies:pom:2.1.0.BUILD-SNAPSHOT from/to spring-snapshots https://repo.spring.io/snapshot proxy.example.com @line 20 column 15

and i also add a settings.xml in my home/.m2 with the following code

<proxies>
   <proxy>
      <id>example-proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.example.com</host>
      <port>8080</port>          
      <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
    </proxy>
  </proxies>

I faced the same issue. Got it resolved by adding maven-compiler-plugin in POM for java version 1.8 followed by a Maven force update.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
    </configuration>
</plugin>

Initially I configured my web project's JRE System library from SE 1.5 to 1.8 through IDE. But after updating project from Maven ( project -> Maven -> Update), the system library was automatically returning to older version - 1.5.

As spring boot 2.1.0 requires JDK 1.8+, added the compiler plugin and updated the project. It worked.

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