I am using jdk 8 and maven version 3.3.9 to create spring boot application with latest version 1.5.6.RELEASE. I am getting the following Warning messages while running mvn clean install
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.XXXX:foo:jar:1.0.0
[WARNING] 'parent.relativePath' of POM com.XXX:foo:1.0.0 (/home/user/parent/foo/pom.xml) points at com.XXX:parent instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure @ line 12, column 13
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.XXX:bar:jar:1.0.0
[WARNING] 'parent.relativePath' of POM com.XXX:bar:1.0.0 (/home/user/parent/bar/pom.xml) points at com.XXX:parent instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure @ line 12, column 13
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
My project is a multi-module build. The directory structure is:
xxx-project
|-- pom.xml
|-- foo
| |-- pom.xml
|-- bar
| |-- pom.xml
My foo/pom.xml is:
<?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.xxx</groupId>
<artifactId>foo</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>foo</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>com.xxx.foo.App</start-class>
<java.version>1.8</java.version>
<lombok.version>1.16.18</lombok.version>
<log4jdbc.log4j2.version>1.16</log4jdbc.log4j2.version>
<rest.assured.version>3.0.3</rest.assured.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-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
<version>${log4jdbc.log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest.assured.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>${spring-loaded.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
The above pom.xml is generated using maven archetype spring-boot-blank project from github.
The parent pom.xml is:
<?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.XXX</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<name>parent</name>
<modules>
<module>foo</module>
<module>bar</module>
</modules>
</project>
How to solve this warning messages while compiling my source code?
Kindly provide your inputs.
The problem occurs because Maven by default assumes that the parent pom is found in the parent folder of the one that contains the module pom. However, in your project that does not seem to be the case: Your parent pom is org.springframework.boot:spring-boot-starter-parent:1.5.6.RELEASE while the pom com.xxx:parent:1.0.0 in the parent folder is only used as an aggregator for the modules.
To solve this problem you need to unset the relative path in the parent declaration in the module poms like this:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath/>
</parent>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With