Reputation: 55
How can I define the source folder order in my maven pom file? I am currently using the standard maven directory layout but whenever I run the command "mvn eclipse:eclipse" the source folder order is as follows:
How can I have it set to:
The class path file generated also has the test folders before the main folders.
Upvotes: 4
Views: 1083
Reputation: 3587
To get the order you prefer, add this to your pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.10</version><!-- correct version for you? -->
<configuration>
<testSourcesLast>true</testSourcesLast>
</configuration>
</plugin>
</plugins>
</build>
Upvotes: 5
Reputation: 23238
This is intentional, because when running unit tests under Maven with the surefire plugin, test classes and resources come before the main classes and resources in the classpath. This allows test resources to override the main ones, for example a log4j.properties
file to have different logging settings for testing than in the standard build.
Additional:
Surefire (since 2.0.8) classpath order described here: http://jira.codehaus.org/browse/MNG-3118
Upvotes: 1