Let’s assume we want to exclude com.choonchernlim.epicapp.scratch
package when we create the JAR file.
Add the following in pom.xml
:-
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <executions> <execution> <id>default-jar</id> <phase>package</phase> <goals> <goal>jar</goal> </goals> <configuration> <excludes> <exclude>**/scratch/**</exclude> </excludes> </configuration> </execution> </executions> </plugin>
The key here is to specify the execution ID called default-jar
.