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 文件,将 ...
随机推荐
- 计算机&编程语言发展史
计算机&编程语言发展史 编辑于2020-11-18 计算机的基本组成 计算机的发展经历了哪几代? 第一代 电子管计算机 第二代 晶体管计算机 第三代 集成电路计算机 第四代 大规模和超大规模集 ...
- Route_of_Linux
爬过六个陡坡,对Linux了如指掌 本文是极客时间App中刘超老师趣谈Linux操作系统的学习路径课程的学习笔记 抛弃旧思维习惯,熟练使用命令行 要从Windows的思维习惯,切换成Linux的命令行 ...
- uniapp兄弟组件如何修改数据?一看就废!
1. 如A组件里有个num = 10 并需要在生命周期函数created里通过uniapp提供的uni.$on方法来注册全局事件,并加一个形参.( uni.$on( '自定义事件名') , 形参 =& ...
- 聊聊kafka-client的源码
一,感想 kafka 客户端代码很早以前 我就想研究借鉴一下,我前前后后至少阅读过三遍源码,我发现我看不下去,不知道为啥这么写,在次期间,我也参考了很多的网上的源码分析,我发现自己依然一知半解的, 慢 ...
- 企业安全06-Fastjson-CNVD-2017-02833
Fastjson-CNVD-2017-02833 一.漏洞概述 fastjson在解析json的过程中,支持使用@type字段来指定反序列化的类型,并调用该类的set/get方法来访问属性,当组件开启 ...
- Java复数的定义与描述
1 //4.复数的定义与描述 2 package test; 3 4 import java.util.Scanner; 5 6 public class complex {//复数类 7 doubl ...
- .net core3.1开始页面实时编译
安装NuGet包 Install-Package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation startup.cs 中的ConfigureSe ...
- php项目使用git的webhooks实现自动部署
前言 在项目开发中使用git进行代码的管理,每次完成更改上传代码后,还需要登录服务器将代码拉取下来.现在git服务器(gitee/gitlab/github)都会有Webhooks功能,以实现在向gi ...
- macos brew zookeeper,安装后zookeeper启动失败?
一.Zookeeper安装流程 执行如下安装命令: brew install zookeeper 执行截图如下: 安装后查看 zookeeper 安装信息(默认拉取最新版本) brew info zo ...
- scentos7安装redis,以及redis的主从配置
redis的安装 下载redis安装包 wget http://download.redis.io/releases/redis-4.0.6.tar.gz 解压压缩包 tar -zxvf redis- ...