Index: maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java =================================================================== --- maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java (revision 330864) +++ maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java (working copy) @@ -107,6 +107,13 @@ */ private String test; + /** + * determine whether or not to include the path of the compiled classes into battery to search for tests to run + * + * @parameter expression="false" + */ + private Boolean includeProjectClassesBattery; + /** * List of patterns (separated by commas) used to specify the tests that should be included in testing. * When not specified and whent the test parameter is not specified, the default includes will be @@ -234,11 +241,17 @@ if ( excludes == null || excludes.size() == 0 ) { excludes = new ArrayList( - Arrays.asList( new String[]{"**/Abstract*Test.java", "**/Abstract*TestCase.java"} ) ); + Arrays.asList( new String[]{"**/Abstract*Test.java", "**/Abstract*TestCase.java", "**/*$*"} ) ); } surefireBooter.addBattery( "org.codehaus.surefire.battery.DirectoryBattery", new Object[]{testClassesDirectory, includes, excludes} ); + + if ( includeProjectClassesBattery.booleanValue() ) + { + surefireBooter.addBattery( "org.codehaus.surefire.battery.DirectoryBattery", + new Object[]{classesDirectory, includes, excludes} ); + } } // ----------------------------------------------------------------------