The maven dependency of the Maven-jar-plugin plugin is:
<dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId> Maven-jar-plugin</artifactid> <version>2.6</version></dependency>
One: Package runnable jar
Configured to:
<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId>< artifactid>maven-jar-plugin</artifactid><version>2.6</version><configuration>< archive><manifest><addclasspath>true</addclasspath><classpathprefix>lib/</ classpathprefix><mainclass>com.lala.shop.app</mainclass></manifest></archive></ configuration></plugin><plugin><groupid>org.apache.maven.plugins</groupid>< Artifactid>maven-dependency-plugin</artifactid><version>2.10</version><executions> <execution><id>copy</id><phase>package</phase><goals><goal> copy-dependencies</goal></goals><configuration><outputdirectory>${ Project.build.directory}/lib</outputdirectory></configuration></execution></executions ></plugin></plugins></build>
Assuming that the project has dependencies on other jars, it is necessary for the Maven-dependency-plugin plugin to package other dependencies as well, otherwise. There is no need
Two: Packaging part of the package
Say. I just want to pack com.lala.api* the following classes. The configuration such as the following
<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId>< artifactid>maven-jar-plugin</artifactid><version>2.6</version><configuration>< includes><include>**/api/*</include></includes></configuration></plugin></ Plugins></build>
MAVEN Technical Exchange Buckle Group 379165311, the group will occasionally share some Maven articles and tutorials, you are welcome to increase
Maven Plugin Introduction Maven-jar-plugin