Reputation: 526
I've just create a new spring boot projet and i have a probleme in the pom.xml and i have no idea how to resolve it, please some help, thanks for all.
the error in the the pom.xml it in the parent tag whitch is :
Project build error: Non-resolvable parent POM for com.example:ProjetTest:0.0.1-SNAPSHOT: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.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.0.RELEASE from/to central (https://repo.maven.apache.org/ maven2): Connection refused: connect and 'parent.relativePath' points at no local POM
<?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.example</groupId>
<artifactId>Ticketing</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Ticketing</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.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>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Upvotes: 10
Views: 82602
Reputation: 1281
In my case it was a internet proxy issue.
This might be a problem with the internet proxy as well. Check your internet proxy settings. Somehow MAVEN is not able to download the dependencies because of proxy.
If you are using proxy, then follow steps mentioned in below link https://maven.apache.org/guides/mini/guide-proxies.html
I have used below configuration to make it work.
<settings>
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<!--
<username>....</username>
<password>....</password>
-->
<host>proxy.abcd.com</host>
<port>1234</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
</settings>
Upvotes: 1
Reputation: 9
I was practicing in home, so no proxy with one ISP, it was causing a problem but it was not before in any project for practice only. So deleted the setting.xml in .m2 folder (in windows os). parent error in pom.xml disappeared
Upvotes: 0
Reputation: 131
I was facing the same problem. I followed the following steps:
It should work fine now.
Upvotes: 12
Reputation: 4033
Things to try
<project>
tag like 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>
<!-- Other stuff of the pom.xml here -->
</project>
<relativePath/>
and the parent will look like below:-
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!-- use your specific version here -->
<version>2.0.0.RELEASE</version>
</parent>
If still it is not resolving then it could be various things like:-
M2_FOLDER_LOCATION\.m2\repository\org\springframework\boot\spring-boot-parent
and then re importing the project.Upvotes: 21
Reputation: 1033
relativePath
requires a path inside it like so:
<parent>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
All you likely need to do is remove <relativePath/>
and make your parent look like so:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
</parent>
Upvotes: 2