Spring Boot 2.2.1 RELEASE build error-relative path - spring

Am adding spring-boot parent in my pom.xml file as given below
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1 RELEASE</version>
<relativePath/>
</parent>
i was change version version definition into <properties> tag as given below
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>2.2.1.RELEASE</spring-boot.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>${spring-boot.version}</version>
<relativePath/>
</parent>
after this change am getting build error
Project build error: Non-resolvable parent POM for abc:abc:7.0.0.0: Failure to find org.springframework.boot:spring-boot-starter-parent:pom:${spring-boot.version} in 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 and 'parent.relativePath' points at no local POM
i tried following solutions
<relativePath/> to <relativePath>/<relativePath>
<relativePath/> to <relativePath>../pom.xml/<relativePath>
Updated maven project
And also i tried following link
stackoverflow

There is no way not to inherit properties from a parent POM. Properties defined in a parent are visible in the child.

Related

resolve dependencies for maven project spring

pom.xml admin-service
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.springframework</groupId>
<artifactId>sai-edm-adminpanel</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sai-edm-adminpanel</name>
<description>sai-edm-adminpanel</description>
<properties>
<java.version>17</java.version>
</properties>
pom.xml authorization service(which depends on the admin service)
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.springframework</groupId>
<artifactId>sai-edm-auth</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sai-edm-auth</name>
<description>sai-edm-auth</description>
<properties>
<java.version>17</java.version>
<spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>com.springframework</groupId>
<artifactId>sai-edm-adminpanel</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
when deploying the project gives me an error "Failed to execute goal on project sai-edm-auth: Could not resolve dependencies for project com.springframework:sai-edm-auth:jar:0.0.1-SNAPSHOT: Could not find artifact com.springframework:sai-edm-adminpanel:jar:0.0.1-SNAPSHOT in spring-milestones (https://repo.spring.io/milestone) -> [Help 1]"
The project is launched locally, the problem is only when deploying, tell me what could be the problem, please
Firstly, you cannot use the groupId "com.springframework" at it is not yours. See the Maven Guide. So for both artifacts sai-edm-adminpanel and sai-edm-adminpanel change the groupId to something you own.
Secondly, remove the compile scope line.
Thirdly, make sure that you have sai-edm-adminpanel artifact installed in your local m2 repository. You can find your local repo under ~/.m2/repository/. If you cannot find it there, you first must install it by going to the sai-edm-adminpanel pom.xml and running mvn clean install.

Maven pom version inheritance

I have 3 projects Parent,Child,SubChild.
Project Parent pom is as follows:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
</parent>
<groupId>mu.parent</groupId>
<artifactId>parent-system</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
....
Project Child pom is defined below and its Parent is defined follows:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>mu.parent</groupId>
<artifactId>parent-system</artifactId>
<version>1.0</version>
</parent>
<groupId>mu.dummy.child</groupId>
<artifactId>child-backend</artifactId>
<name>child-backend</name>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>subChild-app</module>
</modules>
...
Now subChild pom is as follows and the child is defined as parent for subChild :
<parent>
<groupId>mu.dummy.child</groupId>
<artifactId>child-backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>mu.dummy.subchild</groupId>
<artifactId>subchild-backend</artifactId>
<name>subchild-backend</name>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>org.project.test</groupId>
<artifactId>project</artifactId>
<version></version> --version of parent-system???
</dependency>
</dependencies>
Is it possible to get version of parent-system(1.0) in subchild-backend please without hardcoding it?
You can use CI-friendly versions and write ${revision} for the versions, setting this property in the main pom (from which you build everything).
You need to use the flatten Maven plugin, though, to get proper POMs in the repository.
I asked a similar question a while back and determined that tthe groovy-maven-plugin works for this. See this answer.

Non-resolvable parent POM in MAVEN Project

I'm trying to add dependencies to my maven project. I want to add spring boot configuration. but it gives this error in parent tag,
Project build error: Non-resolvable parent POM for
io.javabrains.springbootquickstart:course-api:0.0.1-SNAPSHOT: Failure
to find
org.springframework-boot:spring-boot-starter-parent:pom:1.4.2.RELEASE
in 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 and
'parent.relativePath' points at wrong local POM
I tried with adding relative path to this. But it didn't seem to work out.
<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>io.javabrains.springbootquickstart</groupId>
<artifactId>course-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Java Brains course API</name>
<parent>
<groupId>org.springframework-boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<relativePath>../course_api/pom.xml</relativePath>
</parent>
</project>
You’ve made a small typo in the configuration of your project’s parent. You have used a - rather than a .. You have org.springframework-boot and it should be org.springframework.boot.
Your parent should be the following:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>

Child pom's are not working with multi module spring boot project

I have a parent pom.xml.
There are 2 child pom.xml
But when i do clean for all of them, they cant clean. It gives errors
I tried lots of things. Made same answers from questions but they did not work.
The error is:
Dmaven.multiModuleProjectDirectory=C:\Users\caydin\Applications\evault\yyy "->Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA >2019.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program >Files\JetBrains\IntelliJ IDEA 2019.1\plugins\maven\lib\maven3\bin\m2.conf" "->javaagent:C:\Program Files\JetBrains\IntelliJ IDEA >2019.1\lib\idea_rt.jar=55677:C:\Program Files\JetBrains\IntelliJ IDEA >2019.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program >Files\JetBrains\IntelliJ IDEA 2019.1\plugins\maven\lib\maven3\boot\plexus->classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version2019.1 >clean
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.xxx:yyy-console-backend:0.0.1->SNAPSHOT: Failure to find com.xxx:com.xxx:pom:0.0.1-SNAPSHOT in >http://repo1.maven.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 and 'parent.relativePath' points at wrong local POM # line >5, column 13
[FATAL] Non-resolvable parent POM for com.xxx:com.xxx.frontend:0.0.1-SNAPSHOT: >Failure to find com.xxx:com.xxx:pom:0.0.1-SNAPSHOT in >http://repo1.maven.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 and 'parent.relativePath' points at wrong local POM # line >5, column 13
#
Parent pom
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>LATEST</version>
<!--2.1.3.RELEASE-->
<relativePath></relativePath>
</parent>
<groupId>com.xxx</groupId>
<version>0.0.1-SNAPSHOT</version>
<artifactId>com.xxx</artifactId>
<name>yyyy-console</name>
<description>xxx E-Money (Project:yyyy)</description>
<packaging>pom</packaging>
<properties>
<java.version>1.8</java.version>
</properties>
<modules>
<module>src/main/java/com/xxx/yyyy/backend</module>
<module>src/main/java/com/xxx/yyyy/web</module>
</modules>
child pom for backend
<parent>
<groupId>com.xxx</groupId>
<artifactId>com.xxx</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>yyyy-console-backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>yyyy-console-backend</name>
<description>xxx E-Money (Project:yyyy)</description>
<packaging>jar</packaging>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>//and dependencies for spring
other pom.xml is same with backend.
At first there were only main pomxml. Then i created child pom, took all spring-boot dependencies to other two child pom.
the structure
xxx
pom.xml
backend
pom.xml
web
pom.xml```

STS on ubuntu: Non-resolvable parent POM Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.3.RELEASE

I am trying to work on ubuntu and I face a problem with STS that I have just installed.
This is a toy project and I do not have any proxies as I am using my home network and the internet seem to be working just fine.
I think the problem is ubuntu related as I have installed the same version of STS on my windows computer and it has no problems at all with my project.
I have tried to search on Internet but none of the solutions helped and I could not find any ubuntu specific solutions. My POM is just:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>com.globomatics</groupId>
<artifactId>bike</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>bike</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.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>10</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
And the error is:
Project build error: Non-resolvable parent POM for com.globomatics:bike:0.0.1-SNAPSHOT: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.3.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.3.RELEASE from/to central (https://repo.maven.apache.org/maven2): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty and 'parent.relativePath' points at no local POM pom.xml /bike line 14 Maven pom Loading Problem
I think you just need to update you Java version to a recent Java 8 or more recent.
This is because connections to Maven Central now require TLS 1.2 which is not the default in earlier versions of Java which would explain why Maven cannot download your parent pom.
See Could not transfer artifact (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version -> [Help 1] for details.
The problem has just been solved by itself when I tried to get Gradle plug-in from Marketplace.
Somehow Internet connection in my STS was not fully activated and by installing the plug-in I got it activated and the maven could download dependencies in pom.

Resources