I’m deploying a web application to a service which requires me to package some of the classes to a Jar file.
So in example having the following source tree:
com.enterprise
|------ package1
|------ package2
|------ package3
How can I create a jar including only classes from package1 and package3 but not package2?
You can configure the Maven jar plugin with the
maven.jar.excludesproperty that contains a list of what paths don’t get included into the jar file. To my knowledge this property is automatically used when invokingmvn jar:jar.Or you can directly configure the plugin to include/exclude paths: