How to make a simple MAVEN project support One-jar into a jar Fatjar

Source: Internet
Author: User

<?XML version= "1.0" encoding= "UTF-8"?><Projectxmlns= "http://maven.apache.org/POM/4.0.0"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">    <modelversion>4.0.0</modelversion>    <groupId>Yourgoupid</groupId>    <Artifactid>Yourartifactid</Artifactid>    <version>1.0-snapshot</version>    <Build>        <Plugins>            <!--includes the runtime dependencies -            <plugin>                <groupId>Com.jolira</groupId>                <Artifactid>Onejar-maven-plugin</Artifactid>                <version>1.4.4</version>                <executions>                    <Execution>                        <Goals>                            <goal>One-jar</goal>                        </Goals>                    </Execution>                </executions>            </plugin>            <plugin>                <groupId>Org.apache.maven.plugins</groupId>                <Artifactid>Maven-jar-plugin</Artifactid>                <version>2.4</version>                <Configuration>                    <Archive>                        <Manifest>                            <Addclasspath>True</Addclasspath>                            <Classpathprefix>lib/</Classpathprefix>                            <MainClass>Yourmainclass</MainClass>                        </Manifest>                    </Archive>                </Configuration>            </plugin>        </Plugins>    </Build>    </Project>

In order to make a simple Java program, can be used in the form of Java-jar Yourjar.jar arg1 arg2 Convenient execution, through the One-jar-maven-plugin plug-in can be packaged into a jar, in addition to specify Main-class, You also need to specify Main-class using Maven-jar-plugin.

Reference http://one-jar.sourceforge.net/

One-jar lets a Java application together with its dependency Jars to a single executable JAR file.

How to make a simple MAVEN project support One-jar into a jar Fatjar

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.