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
Instead of excluding dependencies in a profile, you can set them as provided
in it. This doesn't require any overly complex configuration and will exclude the dependencies you don't want from the final build.
In the desired profile, add a dependencies
section, copy the declaration of the ones you want to exclude and scope them as provided
.
For example, let say you want to exclude slf4j-log4j12
:
no-slf4j-log4j12
org.slf4j
slf4j-log4j12
1.7.2
provided