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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM