POM文件
<build><resources><resource><directory>src/main/java</directory><excludes><exclude>**/*.java</exclude></excludes></resource></resources></build>
maven配置文件默认路径都在resources下,pom里的默认配置为:
-
<build>
-
<finalName>springmvc </finalName>
-
<!-- 默认源代码和资源文件目录配置 -->
-
<sourceDirectory>src/main/java </sourceDirectory>
-
<testSourceDirectory>src/test/java </testSourceDirectory>
-
<resources>
-
<resource>
-
<directory>src/main/resources </directory>
-
</resource>
-
</resources>
-
<testResources>
-
<testResource>
-
<directory>src/test/resources </directory>
-
</testResource>
-
</testResources>
-
-
</build>
如果修改配置文件路径,例如将log4j.properties文件放到resources下的conf目录下,则项目编译后找不到,修改为如下即可:
-
<build>
-
<finalName>springmvc </finalName>
-
<!-- 默认源代码和资源文件目录配置 -->
-
<sourceDirectory>src/main/java </sourceDirectory>
-
<testSourceDirectory>src/test/java </testSourceDirectory>
-
<resources>
-
<resource>
-
<directory>src/main/resources </directory>
-
</resource>
-
<resource>
-
<directory>src/main/resources/conf </directory>
-
</resource>
-
</resources>
-
<testResources>
-
<testResource>
-
<directory>src/test/resources </directory>
-
</testResource>
-
</testResources>
-
-
</build>
-