Reputation: 6430
I'm trying to list all artifacts in com.example
, except those in com.example.foo.bar
.
For mvn dependency:tree
, I can do this:
mvn dependency:tree -Dexcludes=*bar* -Dincludes=com.example.*
However, when I try:
mvn dependency:list -DexcludeGroupIds=com.example.foo.bar -DincludeGroupIds=com.example
Maven still lists everything in bar
.
Question: How can I mirror the results from dependency:tree
using list
?
Upvotes: 1
Views: 1296
Reputation: 27812
The main difference between include/excludes of tree
vs list
is that the former expects a pattern while the latter exact matchings.
For instance, the includes
option of the tree
goal can have a value:
where each pattern segment is optional and supports full and partial * wildcards.
On the other hand, the includeGroupIds
option of the list
goal is a simple:
Comma separated list of GroupIds to include.
Given the following dependencies example:
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<!-- other dependencies with different groupIds than the prefix org.apache -->
...
</dependencies>
If we want to include only commons
but exclude logging
for both goals we should run:
mvn dependency:tree -Dincludes=org.apache.* -Dexcludes=*logging*
Note the wildcards applied to both patterns. We need both options, since the first doesn't exclude the second.
For the list
goal in this case only inclusion would be enough, since we list only what we actually want:
mvn dependency:list -DincludeGroupIds=org.apache.commons
Upvotes: 1