Java Maven配置pom.xml build保證所有指定檔案必定會被編譯打包 防止打包失敗

zmxyzmxy1234發表於2021-03-23

在專案目錄裡的pom.xml裡修改或新增,保證所有xml和properties檔案必定會被編譯打包

<build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*.properties</include>
          <include>**/*.xml</include>
        </includes>
        <filtering>true</filtering>
      </resource>
      <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**/*.properties</include>
          <include>**/*.xml</include>
        </includes>
        <filtering>true</filtering>
      </resource>
    </resources>
</build>
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章