简体   繁体   中英

Excluding dependencies in Maven's dependency plugin

In order to speed up my build process, which relies in Docker , I want to generate an image that contains all the maven dependencies already downloaded for my project. For this, I am using maven dependency plugin, invoking the goal dependency:resolve .

My maven project contain two modules ( A and B ) and B depends on A in order for the build to succeed. This means that when I invoke dependency:resolve goal, the process fails when it gets to the module B that depends on A , which has not been built yet (I use -SNAPSHOT versions in the pom.xml for my project).

I have tried excluding this dependency, but I cannot find a way to make it work. How can this be done?

According to the Maven dependency plugin docs you can use additional parameters including excludeArtifactIds.

excludeArtifactIds
Comma separated list of Artifact names to exclude.
Type: java.lang.String
Since: 2.0
Required: No
User Property: excludeArtifactIds

This should help to achieve your goal without messing up your regular build process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM