学习《Maven实战》这门课程时,出现如题所示的错误,在网上找了好久解决方案都没找到什么原因,最后被自己无意间的一个想法给处理掉了这个问题。
错误位置:persist.file=${project.build.testOutputDirectory}/persist.xml
程序报错提示不能解析${project.build.testOutputDirectory}
之后再网上找到说要在pom.xml中配置资源过滤,不然无法解析。
看到这句时,一直没理解,之后对比pom.xml中的所有代码,就发现有一处不对劲,更改后错误就不在提示了。
pom.xml:
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
</build>
项目工程:
于是将pom.xml更改为:
<build>
<testResources>
<testResource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
</build>