1
votes

I am new to the spring boot framework and I'm trying to import the Maven libraries, but I keep getting an error with my pom.xml. Please Help!

Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.4.RELEASE from 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. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.4.RELEASE from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org

Dependency 'org.springframework.boot:spring-boot-starter-web:' not found less... (Ctrl+F1) Inspection info: Inspects a Maven model for resolution problems.

Plugin 'org.springframework.boot:spring-boot-maven-plugin:2.0.4.RELEASE' not found less... (Ctrl+F1) Inspection info: Inspects a Maven model for resolution problems.

Here is my pom.xml below:

<?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.cierra</groupId>
<artifactId>spring-boot</artifactId>
<version>0.0.1-SNAPSHOT</version>

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


<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

<properties>
    <java.version>1.8</java.version>
</properties>

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


</project>
3
The first set-to debugging these issues is to ensure that your project builds from a command line. Therefore please try mvn clean install -U from a command/terminal window and report the results. The "-U" ensures that you don't get cached errors.Steve C
@SteveC C When I run the report I get the following errors: [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for com.cierra:spring-boot:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.4.RELEASE from/to spring-snapshots (repo.spring.io/snapshot): repo.spring.io and 'parent.relativePath' points at no local POM @ line 14, column 13C. Lewis
Spring Boot is currently at 2.1.4.RELEASE. I'd wonder why you're sticking with the older version. If this is a new project, why not be current?duffymo

3 Answers

2
votes

This maybe due to the reason that it is not able to connect and transfer dependencies specified in pom.xml file. The details where it is trying to connect must be mentioned in your settings.xml under .m2 folder

Try adding the pluginRepositories in your pom.xml file:

<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/libs-snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

try adding following repository elements inside repositories element in your pom.xml

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

If this set well, change your updatePolicy settings.

 <repository>
      <id>myRepo</id>
      <name>My Repository</name>
      <releases>
        <enabled>false</enabled>
        <updatePolicy>always</updatePolicy>
        <checksumPolicy>warn</checksumPolicy>
      </releases>
     </repository>

Refer question.

1
votes

The problem was I was behind a proxy that was blocking my pom.xml from running properly. After using a VPN to run the application, it works fine now.

0
votes

Change Your Maven Version Ad Check Again.

Install Maven and Then Go to File/setting/build,execution,.../build Tools/maven And Change Maven Home Directory to Your Install Maven Directory