Maven Plugin Introduction Maven-jar-plugin

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.