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 ...
随机推荐
- Sql Server 主键 外键约束
主键约束 表通常具有包含唯一标识表中每一行的值的一列或一组列. 这样的一列或多列称为表的主键 (PK),用于强制表的实体完整性. 由于主键约束可保证数据的唯一性,因此经常对标识列定义这种约束. 如果为 ...
- 前端MD5加密【单向加密】
密码存储的方式: 密码该如何存储呢?按照安全性由低到高,有这样几种选择: 1.密码名文直接存储在系统中 2.密码经过对称加密后再存储 3.密码经过非对称加密后再存储 步骤: 1.用户端:用户提交用户名 ...
- lambda 表达式拼接
类库: using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions ...
- 20165321实验一 Java开发环境的熟悉
一.idea调试: 二.实验内容: 实现学生成绩管理功能(增删改,排序,查找),并进行测试(正常情况,异常情况,边界情况). 运行截图: 代码: public class Student { Stri ...
- iOS UI基础-10.0 QQ聊天布局之键盘及文本使用
要实现的效果: 这里只说用到的几个知识点 1.图片包含文字 在设置文字的Frame的时候,使用背景(按钮)的尺寸,文字使用了内边距 背景图片,使用拉伸 /** * 返回一张可以随意拉伸不变形的图片 ...
- iOS 设计模式-NSNotificationCenter 通知中心
通知介绍 每一个应用程序都有一个通知中心(NSNotificationCenter)实例,专门负责协助不同对象之间的消息通信 任何一个对象都可以向通知中心发布通知(NSNotification),描述 ...
- element-ui的滚动条组件el-scrollbar(官方没有)
<template> <div style="height:600px;"> <el-scrollbar style="height:100 ...
- InstallShield2015创建安装包
1.新建 InstallScript MSI Project工程 a)输入项目名称Project Name: XBS(例如) b)输入创建目录Location: C:\(例如) c)如果勾选“ ...
- hive中安装hive_utils模块
1. 因为在linux部署的python 3.6 在安装模块的时候遇到了许多问题,所以使用linux中的python3.6环境 2. 首先使用pip安装 hive_utils 模块sudo pip i ...
- caffe训练模型中断的解决办法(利用solverstate)
caffe训练过程中会生成.caffemodel和.solverstate文件,其中caffemodel为模型训练文件,可用于参数解析,solverstate为中间状态文件 当训练过程由于断电等因素中 ...