I have a multi-module project and I use profiles in the parent pom, which has certain dependencies mentioned in them. The problem here is that if in the child pom I override the dependency element and mention one of the dependencies of the parent pom (which is declared in the profile in the parent pom), the version of this particular dependency should be mentioned again.
e.g. Parent pom
<dependencies> <dependency> <groupId>com.mycode.apps</groupId> <artifactId>jobs</artifactId> <version>4</version> </dependency> </dependencies> <profiles> <profile> <id>common-dependencies</id> <activation> <activeByDefault>true</activeByDefault> </activation> <dependencies> <dependency> <groupId>com.mycode.apps</groupId> <artifactId>dao</artifactId> <version>4</version> </dependency> </dependencies> </profile> </profiles>
Now in child pom.xml
<dependencies> <dependency> <groupId>com.mycode.apps</groupId> <artifactId>jobs</artifactId> </dependency> <dependency> <groupId>com.mycode.apps</groupId> <artifactId>dao</artifactId> </dependency> </dependencies>
Any idea what could be wrong, and how can I fix it ??
NOTE. Profile marked activeByDefault
source share