hello there, the attached patch checks first if the 'test' env-var value ends with ".java" or not before constructing the reg-exp for single/specific tests.
with this patch, Eclipse users can select a test and run one external tool similar to the following: <?xml version="1.0" encoding="UTF-8"?> <launchConfiguration type="org.maven.ide.eclipse.Maven2LaunchConfigurationType"> <listAttribute key="M2_PROPERTIES"> <listEntry value="test=${resource_name}"/> </listAttribute> <stringAttribute key="M2_GOALS" value="test"/> <stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/> <listAttribute key="org.eclipse.debug.ui.favoriteGroups"> <listEntry value="org.eclipse.ui.externaltools.launchGroup"/> </listAttribute> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/xxx"/> </launchConfiguration> cheers; rsn
Index: /export/home/workspace/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java =================================================================== --- /export/home/workspace/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java (revision 475119) +++ /export/home/workspace/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java (working copy) @@ -520,7 +520,8 @@ // Check to see if we are running a single test. The raw parameter will // come through if it has not been set. - // FooTest -> **/FooTest.java + // FooTest -> **/FooTest.java + // FooTest.java -> **/FooTest.java includes = new ArrayList(); @@ -530,7 +531,10 @@ for ( int i = 0; i < testRegexes.length; i++ ) { - includes.add( "**/" + testRegexes[i] + ".java" ); + if ( testRegexes[i].endsWith( ".java" ) ) + includes.add( "**/" + testRegexes[i] ); + else + includes.add( "**/" + testRegexes[i] + ".java" ); } } else
pgpbVzXSgjmee.pgp
Description: PGP signature