Maven打包排除某个资源或者目录

论坛 期权论坛 脚本     
已经匿名di用户   2022-7-2 22:16   4523   0

最近在spark streaming本地调试的时候,引入了一些资源文件,打包的时候需要给排除掉。所以就考虑使用maven的方式

详细参考官方文档:https://maven.apache.org/plugins/maven-jar-plugin/examples/include-exclude.html

排除某个资源文件

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <excludes>
                        <exclude>core-site.xml</exclude>
                        <exclude>hdfs-site.xml</exclude>
                    </excludes>
                </configuration>
            </plugin>

排除某个目录

<project>
  ...
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.0.2</version>
        <configuration>
          <includes>
            <include>**/service/*</include>
          </includes>
        </configuration>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>

我的博客即将搬运同步至腾讯云+社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:81
帖子:4969
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP