默認狀況下
java
<build> <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>
配置多個資源文件夾eclipse
<build> <resources> <resource> <directory>src/main/resources</directory> </resource> <resource> <directory>src/labs/resources</directory> </resource> </resources> </build>
使用eclipse要更新一下maven工程的配置。項目右鍵-》maven-》update project configurationmaven
配置讀取源文件夾裏的資源文件ui
<build> <resources> <resource> <directory>src/main/resources</directory> </resource> <resource> <directory>src/labs/resources</directory> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.hbm.xml</include> </includes> </resource> <resource> <directory>src/labs/java</directory> <includes> <include>**/*.hbm.xml</include> </includes> </resource> </resources> </build>
配置多個源文件夾code
<build> <plugins>... <!-- build-helper-maven-plugin, 設置多個源文件夾 --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.4</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>${basedir}/src/labs/java</source> <!-- 咱們能夠經過在這裏添加多個source節點,來添加任意多個源文件夾 --> </sources> </configuration> </execution> </executions> </plugin> </plugins> </build>