美文网首页
maven 打包丢失文件

maven 打包丢失文件

作者: 内蒙小猿 | 来源:发表于2022-03-17 15:29 被阅读0次

摘抄:https://www.cnblogs.com/testopsfeng/p/15384704.html

1、如何更改 pom.xml 文件

  <build>
   <resources>
      <resource>
        <directory>src/main/java</directory>
        <includes>
<!--    自己按需添加 文件类型      -->
          <include>**/*.properties</include>
          <include>**/*.xml</include>
          <include>**/*.json</include>
        </includes>
        <filtering>true</filtering>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
<!--    自己按需添加 文件类型      -->
          <include>**/*.yml</include>
          <include>**/*.properties</include>
          <include>**/*.xml</include>
          <include>**/*.jpg</include>
          <include>**/*.ttf</include>
          <include>**/*.xml</include>
          <include>**/*.json</include>
        </includes>
        <filtering>true</filtering>
        <excludes>
          <exclude>**/*.yml</exclude>
        </excludes>
      </resource>
    </resources>
  </build>

精简版

<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>

2、如果无法生效,按步骤操作

2.1、 clean target

  • 未清理 target 之前


    1.png
  • 点击 clean 之后


    2.png

2.2、结束项目运行,并重新打开idea并重新运行项目。

3.png

3、其他信息

2022年03月17日16:18:44

3.1、 idea

  • IntelliJ IDEA 2021.2 (Ultimate Edition)

3.2、 tomcat

  • apache-tomcat-8.5.72

3.3、maven

  • apache-maven-3.8.4

相关文章

网友评论

      本文标题:maven 打包丢失文件

      本文链接:https://www.haomeiwen.com/subject/gemvdrtx.html