Can I exclude some artifacts from classpath that generates by <addClasspath>true</addClasspath>
option?
For example, I have some dependencies:
<dependency>
<groupId>com.group1</groupId>
<artifactId>lib11</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.group1</groupId>
<artifactId>lib12</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.group2</groupId>
<artifactId>lib21</artifactId>
<version>1.0</version>
</dependency>
At now, my classpath entry in MANIFEST.MF is:
Class-Path: lib/lib11.jar lib/lib12.jar lib/lib21.jar
I want exclude some groupIds of my dependencies list and take entry in this form:
Class-Path: lib/lib21.jar
How I can do it?
When adding a tag scope
with a value provided
to unnecessary dependencies, they disappear from classpath, as required. For an example from the question:
<dependency>
<groupId>com.group1</groupId>
<artifactId>lib11</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.group1</groupId>
<artifactId>lib12</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
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.