Maven Failed to Find dependency : prompt error of 'parent.relativePath' points at wrong local POM - maven

I'm a newbie on Kotlin, Maven, and SpringBoot.
I encounter a problem when trying to build up the sample kotlin project. I actually did add external jar that needed. I just cut a few lines of error out because the other project has the same error.
[FATAL] Non-resolvable parent POM for com.jxinternet.platform:ms-common:1.0-SNAPSHOT: Failure to find com.jxinternet.platform:kotlin-starters:pom:1.0.1 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 # line 3, column 13
[WARNING] 'parent.relativePath' of POM com.jxinternet.platform:ms-account:1.0-SNAPSHOT (C:\Development File\eclipse-workspace\kotlin-starters\ms-account\pom.xml) points at com.jxinternet.platform:kotlin-starters instead of com.jxinternet.platform:dao-starters, please verify your project structure # line 3, column 13
#
[ERROR] The build could not read 9 projects -> [Help 1]
[ERROR]
[ERROR] The project com.jxinternet.platform:ms-data:1.0-SNAPSHOT (C:\Development File\eclipse-workspace\kotlin-starters\ms-data\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for com.jxinternet.platform:ms-data:1.0-SNAPSHOT: Failure to find com.jxinternet.platform:kotlin-starters:pom:1.0.1 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 # line 3, column 13 -> [Help 2]
[ERROR]
below is my build configuration. * I follow some StackOverflow answer*
This is my main 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.jxinternet.platform</groupId>
<artifactId>kotlin-starters</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>ms-parent</name>
<modules>
<module>otp</module>
<module>ms-data</module>
<module>ms-common</module>
<module>ms-account</module>
<module>ms-order</module>
<module>ms-su-web</module>
<module>ms-plugin-web</module>
<module>ms-merchant-web</module>
<module>ms-scheduled-task</module>
<module>ms-payment-web</module>
<!--<module>ms-test</module>-->
</modules>
<properties>
<spring.boot.version>2.0.1.RELEASE</spring.boot.version>
<spring.boot.redis.version>1.4.4.RELEASE</spring.boot.redis.version>
<logback.verion>4.11</logback.verion>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.jxinternet.platform</groupId>
<artifactId>otp</artifactId>
<version>${project.version}</version>
</dependency>
<!-- inner -->
<dependency>
<groupId>com.jxinternet.platform</groupId>
<artifactId>ms-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.jxinternet.platform</groupId>
<artifactId>ms-data</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.jxinternet.platform</groupId>
<artifactId>ms-account</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.jxinternet.platform</groupId>
<artifactId>ms-order</artifactId>
<version>${project.version}</version>
</dependency>
<!-- spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
<version>${spring.boot.redis.version}</version>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>${logback.verion}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<snapshotRepository>
<id>nexus</id>
<name>maven-snapshots</name>
<url>http://192.168.1.25:8081/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus</id>
<name>maven-releases</name>
<url>http://192.168.1.25:8081/repository/maven-releases/</url>
</repository>
</distributionManagement>
</project>
One of my child 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">
<parent>
<artifactId>kotlin-starters</artifactId>
<groupId>com.jxinternet.platform</groupId>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ms-account</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<!-- inner -->
<dependency>
<groupId>com.jxinternet.platform</groupId>
<artifactId>ms-data</artifactId>
</dependency>
<dependency>
<groupId>com.jxinternet.platform</groupId>
<artifactId>ms-common</artifactId>
</dependency>
<dependency>
<groupId>com.jxinternet.platform</groupId>
<artifactId>otp</artifactId>
</dependency>
<!-- redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.jxinternet.platform</groupId>
<artifactId>money-system-parent</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Guys, I super newbie, I don't know what caused the error and don't know how to fix this. I'm looking for StackOverflow answer, some say look for my m2 folder. But i would'n know what to look for...I so lose. Thanks, guys.

Your parent version is 1.0-SNAPSHOT yet in the child pom.xml for ms-data you're specifying parent version as 1.0.1. It should be 1.0-SNAPSHOT. Check all others as well so the parent version matches.

Related

Dependency activiti-spring-boot-starter not found

I'm starting the spring-boot and the activiti dependency cant' download from this repo - https://repo.maven.apache.org/maven2
The error - Could not find artifact org.activiti:activiti-spring-boot-starter:pom:unknown in central (https://repo.maven.apache.org/maven2)
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>[enter image description here][1]
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.10</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</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>
</project>
The error shows that the version is not known:
Could not find artifact org.activiti:activiti-spring-boot-starter:pom:unknown.
You could specify a version like so:
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter</artifactId>
<version>7.1.0.M6</version>
</dependency>
Which I found here. However are you sure you have the right dependency? Looking at this guide the dependency shown is:
<dependency>
<groupId>org.activiti</groupId>
<artifactId>spring-boot-starter-basic</artifactId>
<version>${activiti.version}</version>
</dependency>
The difference being activiti-spring-boot-starter ->spring-boot-starter-basic

Maven Child Project- Non-resolvable parent POM

I'm trying to make a child project into a parent project (This child project really doesn't depend on parent so I'm trying to make this a parent project so I can merge it with another project during jenkins file).
I changed the parent section of the POM file
<parent>
<artifactId>org.springframework.boot</artifactId>
<groupId>spring-boot-starter-parent</groupId>
<version>1.2.5.RELEASE</version>
</parent>
But when I build I get the following error in jenkins.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[[1;34mINFO[m] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/spring-boot-starter-parent/org.springframework.boot/1.2.5%20RELEASE/org.springframework.boot-1.2.5%20RELEASE.pom
[[1;31mERROR[m] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for demo-api:demo-api:1.0-SNAPSHOT: Could not find artifact spring-boot-starter-parent:org.springframework.boot:pom:1.2.5 RELEASE in central (https://repo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM # line 5, column 13
#
[[1;31mERROR[m] The build could not read 1 project -> [1m[Help 1][m
[[1;31mERROR[m]
[[1;31mERROR[m] The project demo-api:demo-api:1.0-SNAPSHOT (/home/estt/jenkins/workspace/demo-api-2/pom.xml) has 1 error
[[1;31mERROR[m] Non-resolvable parent POM for demo-api:demo-api:1.0-SNAPSHOT: Could not find artifact spring-boot-starter-parent:org.springframework.boot:pom:1.2.5 RELEASE in central (https://repo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM # line 5, column 13 -> [1m[Help 2][m
[[1;31mERROR[m]
[[1;31mERROR[m] To see the full stack trace of the errors, re-run Maven with the [1m-e[m switch.
[[1;31mERROR[m] Re-run Maven using the [1m-X[m switch to enable full debug logging.
[[1;31mERROR[m]
Here is the complete pom.xml file.
<?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">
<parent>
<artifactId>org.springframework.boot</artifactId>
<groupId>spring-boot-starter-parent</groupId>
<version>1.2.5.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>demo-api</artifactId>
<groupId>demo-api</groupId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.4</version>
<scope>test</scope>
</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>
<configuration>
<mainClass>com.apiDemo.ApiApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Your groupId and artifactId in the parent, are reversed:
Should be:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
<relativePath/>
</parent>
Instead of
<parent>
<groupId>spring-boot-starter-parent</groupId>
<artifactId>org.springframework.boot</artifactId>
<version>1.2.5.RELEASE</version>
<relativePath/>
</parent>

Getting Project build error: Non-resolvable parent POM error in pom

I have created spring boot project through spring initializr, While importing new maven project eclipse shows following error. NOTE: I am using eclipse Luna (32 bit) and java 1.8.
Project build error: Non-resolvable parent POM: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.3.1.RELEASE from http://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.3.1.RELEASE from/to central (http://repo.maven.apache.org/maven2): Failed to transfer http://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.3.1.RELEASE/spring-boot-starter-parent-2.3.1.RELEASE.pom. Error code 501, HTTPS Required and 'parent.relativePath' points at no local POM.
Here is my pom.xml file code.
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.project</groupId>
<artifactId>JodiMilaye</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>JodiMilaye</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<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>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
try to add the following to your pom and then try again the build
after add this subcode it works for me thanks
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

Sonarqube maven plugin : "The 'report' parameter is missing" when analyzing Maven Project

My error log
I'm using sonarqube 6.7.1 to analyze my maven project (maven 3.5.2) & sonar-maven 3.4.0.905. I keep getting the error "The 'report' parameter is missing". I did researches for hours but looks like almost no one has had this error. Did anyone have this same issue?
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project university-service: The 'report' parameter is missing
Here is my POM.xml file:
<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.hoang.universityservice</groupId>
<artifactId>university-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>university-service</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>
<properties>
<java.version>1.8</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-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
In our situation, the root cause was on the Sonar server:
sonar.log:Caused by: java.io.IOException: No space left on device
Freeing up disk space solved the issue.
If you ever get this error, all you have to do is to upgrade to Java SDK 9

Maven profiles behaviour with plugins

Let's say I have a multi-module maven project. One of the project's POM file is the following:
<?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>
<parent>
<groupId>some.group</groupId>
<artifactId>parent-artifact</artifactId>
<version>0.14.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>artifact-x</artifactId>
<packaging>jar</packaging>
<name>Artifact X</name>
<dependencies>
<dependency>
<groupId>some.group</groupId>
<artifactId>artifact-a</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>artifact-b</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>artifact-c</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>artifact-d</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>artifact-e</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
Let's say for some reason, I want to move some of the dependencies in this POM file to a profile. So, I move artifact-c, artifact-d, artifact-e to only be dependencies when using profile-1. profile-1 is also used in other POMs in the project. My new POM now becomes:
<?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>
<parent>
<groupId>some.group</groupId>
<artifactId>parent-artifact</artifactId>
<version>0.14.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>artifact-x</artifactId>
<packaging>jar</packaging>
<name>Artifact X</name>
<dependencies>
<dependency>
<groupId>some.group</groupId>
<artifactId>artifact-a</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>artifact-b</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>profile-1</id>
<dependencies>
<dependency>
<groupId>some.group</groupId>
<artifactId>artifact-c</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>artifact-d</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>some.group</groupId>
<artifactId>artifact-e</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
When building, I run mvn -Pprofile-1 clean package at the top-level POM in both cases. My expectation was that moving dependencies to a profile shouldn't change anything when -Pprofile-1 was specified. But that didn't happen - some of the plugins started behaving erroneously - for ex. the maven-shade-plugin didn't put artifact-c, artifact-d and artifact-e in the shaded jar etc.
Am I doing something wrong? Are profiles not supposed to work like this?
Are these two POM files not equivalent even when used with -Pprofile-1?
Even though the pom.xml allows you to define it like this, you shouldn't (call it a design flaw). Most of the times it doesn't make sense to just add dependencies in a profile. Valid constructions are dependencies based on OS or on JDK version.
Also remember that the pom.xml also acts as "consumer-pom", so other projects using this artifact will read this pom file to get the transitive dependencies. In such case you can't active a profile anymore.
In conclusion: don't try to solve this with profiles. There must be a better solution.

Resources