不少人一开始学习使用maven可能会出现不少问题,其中一个问题就是resources里面的文件没有出现在target,不少人在网上搜索之后可能会找到问题的原因,但是也有一部分人找不到解决方法,在这里我就把我的解决方法发出来,期望可以帮助大家。

 <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                    <include>**/*.tld</include>
                    <include>**/*.xls</include>
                    <include>**/*.xlsx</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.tld</include>
                    <include>**/*.xls</include>
                    <include>**/*.xlsx</include>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>

这个使网上使用最多的方法,如果还是不行的话的可以试试换成:

<resource>
        <includes>
          <include>**/*.properties</include>
          <include>**/*.xml</include>
        </includes>
        <filtering>true</filtering>
      </resource>
    </resources>