When moving a legacy project from Ant to Maven, I needed to change the default source (default: src/[main|test]/java) and resources (default: src/[main|test]/resources) directories in Maven. These settings may be configured in the <build> element of the project’s pom.xml.
- <sourceDirectory> the directory where the sources of your application are stored
- <testSourceDirectory> the directory where the sources of your test cases are stored
- <resources> the resources of your main application
- <testResources> the resources needed only by your test cases
The relevant part of the pom.xml in Maven 2.1.x and above looks like this (with default values):
<project> <!--[...]--> <build> <sourceDirectory>${project.basedir}/src/main/java</sourceDirect <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory> <resources> <resource> <directory>${project.basedir}/src/main/resources</directory> </resource> </resources> <testResources> <testResource> <directory>${project.basedir}/src/test/resources</directory> </testResource> </testResources> <!--[...]--> </build> <!--[...]--> </project>
Links
- maven project site Introduction to the POM
nice blog….