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 the executable 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>
If the project has dependencies on other jars, the Maven-dependency-plugin plug-in will need to be packaged with other dependencies, otherwise it will not need
Two: Packaging part of the package
For example, I just want to pack com.lala.api* the following classes, then configure 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 join
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Maven Plugin Introduction Maven-jar-plugin