I have a maven module which has some dependencies. In a certain profile, I want to exclude some of those dependencies (to be exact, all dependencies with a certain group id). Th
maven is a tool, we can hack it.
For example, in the pom.xml:
... other pom stuff ...
artifact1
artifact2
0.4
0.5
remove-artifact2
artifact1
artifact1
0.4
0.4
artifact1:0.4 and artifact2:0.5 will be the dependency. mvn -P remove-artifact2
The result pom.xml contains only artifact1:0.4 This comes quite handy during api migration where artifact are renamed and versions are not compatible.