Several commonly used plug-ins of Maven and commonly used plug-ins of Maven

Source: Internet
Author: User

Several commonly used plug-ins of Maven and commonly used plug-ins of Maven
Maven-compiler-plugin

Compile the Java source code. Generally, you only need to set the compiled jdk version.

<plugin>    <groupId>org.apache.maven.plugins</groupId>    <artifactId>maven-compiler-plugin</artifactId>    <version>3.6.0</version>    <configuration>        <source>1.8</source>        <target>1.8</target>    </configuration></plugin>

 

Maven-dependency-plugin

Copy the dependent jar package to the specified folder.

<plugin>    <groupId>org.apache.maven.plugins</groupId>    <artifactId>maven-dependency-plugin</artifactId>    <version>2.10</version>    <executions>        <execution>            <id>copy-dependencies</id>            <phase>package</phase>            <goals>                <goal>copy-dependencies</goal>            </goals>            <configuration>                <outputDirectory>${project.build.directory}/lib</outputDirectory>            </configuration>        </execution>    </executions></plugin>
Maven-jar-plugin

Set manifest parameters, for example, specify the Main class to be run, as well as dependent jar packages, and add them to classpath.

<plugin>    <groupId>org.apache.maven.plugins</groupId>    <artifactId>maven-jar-plugin</artifactId>    <version>2.4</version>    <configuration>        <archive>            <manifest>                <addClasspath>true</addClasspath>                <classpathPrefix>/data/lib</classpathPrefix>                <mainClass>com.zhang.spring.App</mainClass>            </manifest>        </archive>    </configuration></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.