-
-
Save hellodk34/54f85621fda7f15fdfbfd333d69d32c3 to your computer and use it in GitHub Desktop.
普通 maven 项目打包,将第三方依赖和程序本体打进一个 jar 包
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<version>2.3.2</version> | |
<configuration> | |
<source>1.8</source> | |
<target>1.8</target> | |
</configuration> | |
</plugin> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-assembly-plugin</artifactId> | |
<version>3.2.0</version> | |
<configuration> | |
<archive> | |
<manifest> | |
<!-- 运行 jar 包时运行的主类,要求写全类名 需要包含 package name --> | |
<mainClass>MainService</mainClass> | |
<!-- 是否指定项目 classpath 下的依赖 --> | |
<addClasspath>true</addClasspath> | |
</manifest> | |
</archive> | |
<descriptorRefs> | |
<descriptorRef>jar-with-dependencies</descriptorRef> | |
</descriptorRefs> | |
</configuration> | |
<executions> | |
<execution> | |
<id>make-assembly</id> | |
<phase>package</phase> | |
<goals> | |
<goal>single</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment