Maven 打包可执行jar文件
来源:互联网 发布:linux ant配置 编辑:程序博客网 时间:2024/04/27 16:42
<project xmlns="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>com.company.tools</groupId> <artifactId>HelloApp</artifactId> <version>1.0</version> <packaging>jar</packaging> <name>HelloApp</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> <scope>test</scope> </dependency><dependency><groupId>commons-lang</groupId><artifactId>commons-lang</artifactId><version>2.1</version></dependency> </dependencies> <build> <plugins><plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <configuration><appendAssemblyId>false</appendAssemblyId> <archive> <manifest><addClasspath>true</addClasspath> <mainClass>com.company.tools.App</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration><executions> <!-- auto jar with dependencies when pakcage--><execution><id>make-assembly</id><phase>package</phase><goals><goal>single</goal></goals></execution></executions> </plugin> </plugins> </build></project>