maven 打包丢失文件

2022-03-17  本文已影响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

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

3.png

3、其他信息

2022年03月17日16:18:44

3.1、 idea

3.2、 tomcat

3.3、maven

上一篇 下一篇

猜你喜欢

热点阅读