Maven工程打成一个jar包
1:maven-shade-plugin 插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.test.TestClient</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
2:maven-assembly-plugin插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass></mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
4:参考
https://www.cnblogs.com/fuxinci/p/3356087.html
Maven工程打成一个jar包的更多相关文章
- 如何把一个java工程打成一个jar包(转载)
1.jar包有入口(即有main()函数) 选中要打包的工程--->右键选择Export---->java----->Runnable java file----->next- ...
- Maven将代码及依赖打成一个Jar包的方式
Maven可以使用mvn package指令对项目进行打包,如果使用java -jar xxx.jar执行运行jar文件,会出现"no main manifest attribute, in ...
- maven 引用另一个jar包 需要先打包在仓库里面 并在pom里面配置 才可以引用
maven 引用另一个jar包 需要先打包在仓库里面 并在pom里面配置 才可以引用
- maven将项目及第三方jar打成一个jar包
pom.xml中添加如下配置 把依赖包和自己项目的文件打包如同一个jar包(这种方式对spring的项目不支持) <build> <plugins> <plugin> ...
- maven工程引用外部jar包
maven工程经常回遇到引用外部jar包,需要先安装在jar包,然后再在工程中pom.xml文件中添加依赖. 示例: 命令行中运行: mvn install:install-file -Dfile=E ...
- 使用IDEA的maven工程导入ojdbc14 jar包失败
原因:ojdbc是要收费的所以maven无法通过中央仓库下载. 一开始以为是我网络不好,导致下载一直失败,可是我怎么想都不对劲,因为我自己使用了阿里云的镜像,网络不可能有问题吧,于是又使用外网,重新导 ...
- maven工程引入外部jar包
pom.xml: <dependency> <groupId>new</groupId> <artifactId>new</artifactId& ...
- 【idea】idea如何在maven工程中引入jar包
在pom.xml文件中引入所有代码包后,项目右键--maven--reimport </dependencies>
- maven工程编译成jar包
在pom文件的project节点下增加build节点,mvn package即可 <build> <plugins> <plugin> <artifactId ...
随机推荐
- BI-LSTM and CRF using Keras
问题1:CUDA_ERROR_OUT_OF_MEMORY: How to activate multiple GPUs from Keras in Tensorflow import keras.ba ...
- .Net Core资源
官网:https://dotnet.github.io/ 1.开发环境 vs2015安装: .net core sdk : https://download.microsoft.com/downloa ...
- fiddler抓取https-----重要
原文地址https://www.cnblogs.com/joshua317/p/8670923.html 很多使用fiddler抓包,对于http来说不需太多纠结,随便设置下就能用,但是抓取https ...
- iOS 开发笔记-获取某个APP素材
2019.02.01 更新 以下这种方式只适合越狱的手机,目前12.1以后,iTools已经不适合了,请看最下面第二种方式. 有时候,我们看到别人的APP做得挺漂亮的,那么我们想查看该APP的图片素材 ...
- gcc常用命令使用
gcc编译文件过程 .c文件到 .i文件 到.s(汇编文件) 到.o文件,再到可执行文件 .c到.i 实操一下: test.c文件如下 : #include <stdlib.h> #inc ...
- Hadoopif.for.while 语句
if 语句 echo 当前参数个数:$# if [ $# -lt 3 ];then echo 参数小于3;elif [ $# -gt 5 ];then echo 参数大于5;fi; To have b ...
- Linux 重启nginx
重启 1.验证nginx配置文件是否正确 方法一:进入nginx安装目录sbin下,输入命令./nginx -t 看到如下显示nginx.conf syntax is ok nginx.conf te ...
- django admim后台不转义提交的html
autoescape¶ Controls the current auto-escaping behavior. This tag takes either on or off as an argum ...
- Gardener Bo (树剖 + 问题分解)
一开始没看懂计算答案的第四部和update2,很迷.然后一直推敲之后才发下我计算的时候漏掉一个关键点.没有把加值的影响放到父节点上. #include<bits/stdc++.h> #de ...
- linux 安装 Python
一. 打开终端,输入:wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0b4.tgz 下载完毕后 输入解压命令:tar –zxvf Py ...