zoukankan      html  css  js  c++  java
  • maven-shade-plugin~打包时过滤项目中某些包

    maven-shade-plugin可以用来进行打包,并实现在打包过程中的一些过滤、排除、包含、重命名等一系列操作,当我们设计公用项目时,有时在项目时会有一些测试用例,如果在打包时想把这些测试包排除,使用maven-shade-plugin插件是个不错的选择。

    打包包含和排除

    下面的代码实现了以下几个功能:

    • 打包时排除com.lind.uaa.jwt.three包下的所有内容
    • 打包时排除项目的properties类型的配置文件
    • 打包时,com.baomidou组织的包添加到当然JAR包里,默认是不会添加到当前包的
    • createSourcesJar选项实现了打包时为源代码再打一个包
     <build>
            <plugins>
                <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>**/*.properties</exclude>
                                            <exclude>com/lind/uaa/jwt/three/**</exclude>
                                        </excludes>
                                    </filter>
                                </filters>
                                <artifactSet>
                                    <!-- 捆绑包含,目标项目不需要再手动引用这个包了 -->
                                    <includes>
                                        <include>com.baomidou:*</include>
                                    </includes>
         
                                </artifactSet>
                                <createSourcesJar>true</createSourcesJar>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    

  • 相关阅读:
    Python3---filter,map,reduce
    老男孩-day2作业-计算器
    Python 简易购物系统--老男孩作业
    老男孩-day1作业二
    老男孩-day1作业一
    Axure8.0图片旋转注意
    CentOS6.5部署KVM及实现在线迁移
    CentOS 6.5 安装部署iSCSi共享存储
    CentOS 6.5 安装部署KVM
    CentOS6.5部署L2TP over IPSec
  • 原文地址:https://www.cnblogs.com/lori/p/14129659.html
Copyright © 2011-2022 走看看