问题报错如上:
试了网上很多解决方案都无法解决,大多都是配置文件未打包,解决方案都是改资源打包规则,方法有很多,如:
<build>
<!--idea 识别.xml 指定资源的位置-->
<resources>
<resource>
<directory>src/main/java</directory><!--所在目录-->
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory><!--所在目录-->
<includes>
<include>**/*.yml</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
亦或者改变打包方式
<packaging>pom</packaging>
<!--改为jar包-->
<packaging>jar</packaging>
解决方案:
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.*</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>