Newly exposed to Maven, I can understand the use case of the <exclusion>
tag, but not sure why it wouldn't cause compile error:
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-embedder</artifactId>
<version>2.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
</exclusion>
</exclusions>
</dependency>
...
Is this only possible only when you have another direct dependency on maven-core? otherwise, compile error should happen. (assuming maven-core
is used somewhere in maven-embedder
)
There are different possibilities:
dependency:tree
if the dependency is not pulled in from somewhere else.maven-core
is not used at all, even if maven-embedder
indeed uses it: Assume e.g. that maven-embedder
has two classes A and B. You only use A, but maven-core
is only used by B. Then (if A and B do not use each other), your project might be entirely independent of maven-core
. (A side remark: some jars should logically be two separate jars, but where merged together by whatever reason - in our example, one should think about putting A and B in separate artifacts).