maven的两种打包插件 ,防止 将无用文件打入META_INF,找不到主类的问题
第三种 打依赖包 将依赖其他jar的包都打进去
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/src.xml</descriptor>
</descriptors>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
可以直接声明主类
<!-- If you have classpath issue like NoDefClassError,... -->
<!-- useManifestOnlyJar>false</useManifestOnlyJar -->
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin> 第二种
<!--<plugin>-->
<!--<!– 将第三方的依赖包,一起打入到最终形成的jar文件中 –>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-shade-plugin</artifactId>-->
<!--<version>2.1</version>-->
<!--<executions>-->
<!--<execution>-->
<!--<phase>package</phase>-->
<!--<goals>-->
<!--<goal>shade</goal>-->
<!--</goals>-->
<!--<configuration>-->
<!--<transformers>-->
<!--<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">-->
<!--<mainClass>com.bigdata.bokong.offline.SmartAuditStat</mainClass>-->
<!--</transformer>-->
<!--</transformers>-->
<!--<!–<transformers>–>-->
<!--<!–<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">–>-->
<!--<!–<mainClass>com.wondertek.bigdata.offline.service.converter.server.DimensionConverterServer</mainClass>–>-->
<!--<!–</transformer>–>-->
<!--<!–</transformers>–>-->
<!--<!–<artifactSet>-->
<!--<includes>-->
<!--<include>cz.mallat.uasparser:uasparser</include>-->
<!--<include>net.sourceforge.jregex:jregex</include>-->
<!--<include>mysql:mysql-connector-java</include>-->
<!--</includes>-->
<!--</artifactSet>–>-->
<!--<filters>-->
<!--<filter>-->
<!--<artifact>*:*</artifact>-->
<!--<excludes>-->
<!--<exclude>META-INF/*.SF</exclude>-->
<!--<exclude>META-INF/*.DSA</exclude>-->
<!--<exclude>META-INF/*.RSA</exclude>-->
<!--</excludes>-->
<!--</filter>-->
<!--</filters>-->
<!--</configuration>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->
</plugins>
maven的两种打包插件 ,防止 将无用文件打入META_INF,找不到主类的问题的更多相关文章
- maven的两种打包方式
1.maven目前在web上面的使用方式很普遍,而打包的方式也存在很多方式 2.因为涉及一个项目调用另外一个项目的包,并将另外一个项目打成jar的形式便于管理 3.maven打包第一种方式: 将项目检 ...
- Springboot中IDE支持两种打包方式,即jar包和war包
Springboot中IDE支持两种打包方式,即jar包和war包 打包之前修改pom.xml中的packaging节点,改为jar或者war 在项目的根目录执行maven 命令clean pa ...
- 关于springboot项目的jar和war两种打包方式部署的区别
关于springboot项目的jar和war两种打包方式部署的区别 关于springboot项目的jar和war两种打包方式部署的区别? https://bbs.csdn.net/topics/392 ...
- IDEA中项目的两种打包方式
本文主要介绍在IDEA中怎么打包,及可以用哪种方式打包. 若是有指正或补充的,欢迎留言~ ٩(●̮̃•)۶ 接下来进入正题: IDEA中打包需要先进行配置,so,我们先打开<abbr titl ...
- springboot打包成jar包后找不到xml,找不到主类的解决方法
springboot打包成jar包后找不到xml,找不到主类的解决方法 请首先保证你的项目能正常运行(即不打包的时候运行无误),我们在打包时经常遇到如下问题: springboot打包成jar包后找不 ...
- maven 把spring项目打包成可执行的文件
转载自http://www.mamicod.e.com/info-detail-635726.html 最近需要解决Maven项目导入可执行的jar包的问题,如果项目不包含Spring,那么使用mvn ...
- 【maven】成功生成jar包,提示找不到主类?
问题描述: 使用maven构建zookeeper项目,完成一个简单的创建组的实例,代码调试完成,使用mvn clean install成功打包得到了jar包,但是在执行时发现使用java -cp ...
- Mybatis-plus的两种分页插件的配置方式
第一种: package com.paic.ocss.gateway.admin.config; import com.baomidou.mybatisplus.plugins.PaginationI ...
- MyEclipse10 中的两种FreeMarker插件的安装与配置
第一个插件是: freemarker-ide MyEclipce10.0中安装FreeMarker插件,这绝对是最简单的方法 ...
随机推荐
- postman上传图片时已经添加cookie,但仍显示未登陆
postman上传图片时,已经添加过cookie,但是返回的结果是用户未登陆,如下图所示: 我的解决办法是:清楚cookie code中的cookie 最终的结果如下:成功
- Jedis自己整理比较全的API
package com.tebon.ams.utils; import com.alibaba.fastjson.JSON;import com.tebon.ams.util.ObjectUtil;i ...
- pthread_detach()与pthread_join的区别?
简单来说: pthread_detach()即主线程与子线程分离,子线程结束后,资源自动回收.pthread_join()即是子线程合入主线程,主线程阻塞等待子线程结束,然后回收子线程资源. [转]在 ...
- VS2017 SVN插件-AnkhSVN
AnkhSVN 该插件可以直接在vs017扩展和工具里安装,安装完成即可使用 默认VS自带的源码管理工具是GIT 如果已经使用需要手动切换到SVN:工具==>选项菜单中设置 SVN使用方法: 1 ...
- Python_tkinter(2)_常用控件
1.Label--标签(文字/位图)控件 from tkinter import * root = Tk() root.geometry('200x200') # Label控件 字体.边框.背景 l ...
- 【大数据和云计算技术社区】分库分表技术演进&最佳实践笔记
1.需求背景 移动互联网时代,海量的用户每天产生海量的数量,这些海量数据远不是一张表能Hold住的.比如 用户表:支付宝8亿,微信10亿.CITIC对公140万,对私8700万. 订单表:美团每天几千 ...
- MongoDB - Indexes
#explain command pp db[:zips].find(:state => 'MD').explain #List all indexes: db[:zips].indexes.e ...
- pandas(三)
合并数据集: 创建一个能创建dataframe的函数 def make_data(cols,ind): data={c:[strc(c)+str(i) for i in ind] for c in c ...
- C#递归复习
static void Main(string[] args) { Console.WriteLine("请输入你要的数字:"); long flag = Convert.To ...
- python基础语法-->多项分支-->巢状分支
# ### 多项分支 """ if 条件表达式: codel1... codel1... else 条件表达式 coedl2.. coedl2.. else 条件表达式 ...