maven-assembly-plugin插件打jar包时排出指定的依赖
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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.unionpay.bigdataTest</groupId>
<artifactId>kafka-tool-recordkryo</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<!-- Provided by kafkatool2 -->
<dependency>
<groupId>com.kafkatool</groupId>
<artifactId>kafkatool</artifactId>
<version>2.0.7</version>
<scope>system</scope>
<systemPath>${basedir}/lib/ofjar.jar</systemPath>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.62</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.9</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<descriptors> <!--描述文件路径-->
<descriptor>src/main/assembly/package.xml</descriptor>
</descriptors>
<!--
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
-->
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
src/main/assembly/package.xml
<?xml version="1.0" encoding="UTF-8" ?>
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
<excludes>
<!-- 排除这些在kafkatool2/lib存在的相关依赖-->
<exclude>com.google.code.gson:gson</exclude>
<exclude>org.apache.zookeeper:zookeeper</exclude>
<!-- 这些应该用不到-->
<exclude>org.apache.hadoop:hadoop-annotations</exclude>
<exclude>org.apache.hadoop:hadoop-auth</exclude>
<exclude>org.apache.hadoop:hadoop-common</exclude>
<exclude>org.apache.hadoop:hadoop-core</exclude>
<exclude>org.apache.hbase:hbase-annotations</exclude>
<exclude>org.apache.hbase:hbase-client</exclude>
<exclude>org.apache.hbase:hbase-protocol</exclude>
<exclude>org.apache.hbase:hbase-common</exclude>
<exclude>org.apache.kudu:kudu-client</exclude>
<exclude>io.netty:netty-all</exclude>
<exclude>javax.mail:mail</exclude>
<exclude>javax.servlet.jsp:jsp-api</exclude>
<exclude>javax.servlet:servlet-api</exclude>
<exclude>junit:junit</exclude>
<exclude>tomcat:jasper-compiler</exclude>
<exclude>tomcat:jasper-runtime</exclude>
<exclude>hsqldb:hsqldb</exclude>
<exclude>com.github.stephenc.findbugs:findbugs-annotations</exclude>
<exclude>com.google.code.findbugs:jsr</exclude>
<exclude>com.sun.jersey:jersey-core</exclude>
<exclude>com.sun.jersey:jersey-json</exclude>
<exclude>commons-httpclient:commons-httpclient</exclude>
<exclude>org.apache.curator:curator-client</exclude>
<exclude>org.apache.curator:curator-framework</exclude>
<exclude>org.apache.curator:curator-recipes</exclude>
<exclude>org.mortbay.jetty:jetty</exclude>
<exclude>org.mortbay.jetty:jetty-util</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>
maven-assembly-plugin插件打jar包时排出指定的依赖的更多相关文章
- Maven pom.xml 配置说明: 打jar包不包括指定资源文件和.class xml,配置不跑testCase,建pom父子项目
**maven如何配置打jar包时,一些class 或者资源文件不打进来,把classpath的xml文件打进jar <build> <!--针对资源文件--> <res ...
- 记录一次maven打包时将test目录下的类打包到jar中,Maven Assembly Plugin的使用
今天有人问我打包后找不到主类,运行的类写在test中.按照常规,test目录下的文件不会打包到jar包中.(但是我测试一个springboot工程就可以,这里之后再研究) 具体解决如下 第一步:在po ...
- maven项目用assembly打包可执行jar包
该方法只可打包非spring项目的可执行jar包,spring项目可参考:http://www.cnblogs.com/guazi/p/6789679.html 1.添加maven插件: <!- ...
- IDEA使用maven插件打jar包流程
idea使用maven插件打jar包步骤以及遇到的问题 idea自带了maven工具,idea右边点击maven选项: 一.在pom中添加插件,直接复制就好,如下选项 <plugin> & ...
- maven引入jar包时,一个jar的引入错误,会导致后来的jar包的引入。
maven引入本jar包时,引入失败. 问题是另一个jar没有引入正确.
- [Maven]Maven构建可执行的jar包(包含依赖jar包)
----------------------------------------------------------------- 原创博文,如需转载请注明出处! 博主:疲惫的豆豆 链接:http:/ ...
- springboot 打包插件去除jar包瘦身
1.pom文件配置 <plugin> <groupId>org.springframework.boot</groupId> <artifactId>s ...
- 有引用外部jar包时(J2SE)生成jar文件
一.工程没有引用外部jar包时(J2SE) 选中工程---->右键,Export...--->Java--->选择JAR file--->next-->选择jar fil ...
- Maven 生成可执行的jar包
maven 默认打包生成的 jar 包是不能够直接运行的,因为带有 main 方法的类信息不会添加到 manifest 中,即打开 jar 文件中的 META-INF/MANIFEST.MF 文件,将 ...
随机推荐
- 图解HTTP简单笔记【上】
第一章 了解WEB及网络基础(省略了TCP/IP的知识点) 1.1.使用HTTP协议访问web 当我们在主机的浏览器的地址输入URL之后 请求将回发送至目标服务器 目标服务器在接受到响应请求时将会响 ...
- yum安装no more mirrors to try
先挂载:mount /dev/cdrom /mnt yum clean allyum makecacheyum -y update 后重试
- Golang 实现 Redis(6): 实现 pipeline 模式的 redis 客户端
本文是使用 golang 实现 redis 系列的第六篇, 将介绍如何实现一个 Pipeline 模式的 Redis 客户端. 本文的完整代码在Github:Godis/redis/client 通常 ...
- 不想错过网课?不妨用Camtasia录制下来!
2020年突发的这场疫情给我们的日常生活与学习带来了一些不便,却也意外的让网课走红了起来.小学.中学.大学都开始通过媒体工具或直播平台开始授课,但网络授课与实际课堂上课还是有区别的,学生们受到环境影响 ...
- Java 生成有序 UUID
UUID.randomUUID() 生成的 UUID 是无序的,如果作为数据主键,不利于索引 Hibernate 的 UUIDHexGenerator.generate() 方法可以生成有序的 UUI ...
- PyQt(Python+Qt)学习随笔:QLineEdit行编辑器功能详解
专栏:Python基础教程目录 专栏:使用PyQt开发图形界面Python应用 专栏:PyQt入门学习 老猿Python博文目录 一.概述 QLineEdit部件是一个单行文本编辑器,支持撤消和重做. ...
- 第12.1节 Python os模块导览
os 模块提供了许多与操作系统交互的函数,一定要使用 import os 而不是 from os import * ,这将避免内建的 open() 函数被 os.open() 隐式替换掉,它们的使用方 ...
- 问题:PyCharm的几种调试方法的区别
关于PyCharm的调试方式,step into.step over.step out.run to cursor.resume programe与c语言相关的调试器功能基本相同,但PyCharm提供 ...
- PyQt(Python+Qt)学习随笔:QAbstractItemView的showDropIndicator属性
老猿Python博文目录 老猿Python博客地址 概述 QAbstractItemView的showDropIndicator属性用于控制在拖拽过程中显示当前拖拽到的位置,当释放时则在当前拖拽位置覆 ...
- (转)MySQL优化原理
原文:https://mp.weixin.qq.com/s__biz=MzI4NTA1MDEwNg==&mid=2650763421&idx=1&sn=2515421f09c1 ...