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

最近在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

posted @ 2017-12-21 13:40  xingoo  阅读(29482)  评论(2编辑  收藏  举报