I'm trying to exclude a package in the jar(maven dependency) by editing pom.xml
So I tried some ways that adding tag in the , using maven-shade-plugin, and using maven-jar-plugin. But it didn't work. Package in the jar still exists.
Here're codes I tried. Thanks. artifact is jar name, com.domain.package is package to delete form jar.
<!-- first trial -->
<dependencies>
<dependency>
<groupId>Group</groupId>
<artifactId>artifact</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/artifact.jar</systemPath>
<exclusions>
<exclusion>
<groupId>com.domain.package</groupId>
<artifactId>package</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<!-- second trial -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>artifact:com.domain.package</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
<!-- third trial -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>artifact</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<excludes>
<exclude>**/com/domain/package/*</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>