I have this pom.xml for multi-module project:
<?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.github.alopatin.kafka_learning.java</groupId>
<artifactId>java</artifactId>
<version>1.0</version>
<modules>
<module>resources</module>
<module>producer-simple</module>
<module>producer-json</module>
</modules>
<properties>
<maven.compiler.source>23</maven.compiler.source>
<maven.compiler.target>23</maven.compiler.target>
</properties>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>com.github.alopatin.kafka_learning.java</groupId>
<artifactId>resources</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.4.3</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>3.8.1</version>
</dependency>
</dependencies>
<build>
...
</build>
</project>
Sub-module resources contains common resources for all sub-modules. I don't need any dependencies in this sub-module.
How can I prevent adding dependencies from root pom.xml into one sub-module resources? Now, I get error:
The project com.github.alopatin.kafka_learning.java:resources:1.0 (D:\Wokrspace\kafka-learing\java\resources\pom.xml) has 1 error [ERROR]
'dependencies.dependency.[com.github.alopatin.kafka_learning.java:resources:1.0]' for com.github.alopatin.kafka_learning.java:resources:1.0 is referencing itself. @ com.github.alopatin.kafka_learning.java:java:1.0, D:\Wo krspace\kafka-learing\java\pom.xml, line 36, column 21
dont parenting to parent.pom in your submodule pom