--- main\java\org\codehaus\mojo\serviceloader\ServiceloaderMojo.java Tue Mar 09 10:55:24 2010 +++ new\java\org\codehaus\mojo\serviceloader\ServiceloaderMojo.java Tue Mar 09 10:31:21 2010 @@ -36,6 +36,7 @@ import java.util.Map; import java.util.Stack; import java.util.Map.Entry; +import java.util.regex.Pattern; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -46,6 +47,7 @@ * * @goal generate * @phase compile + * @requiresDependencyResolution compile */ public class ServiceloaderMojo extends AbstractMojo @@ -253,6 +255,10 @@ Stack todo = new Stack(); todo.push( classFolder ); String classFolderPath = classFolder.getAbsolutePath(); + getLog().info("ClassFolderPath=" + classFolderPath); + + Pattern pat = Pattern.compile(classFolderPath + File.separator + "(.*).class"); + File workDir; String name; while ( !todo.isEmpty() ) @@ -270,10 +276,10 @@ { // TODO optimize name = file.getAbsolutePath(); - name = name.replace( classFolderPath + "/", "" ); - name = name.replace( ".class", "" ); - name = name.replace( "/", "." ); - classNames.add( name ); + name = pat.matcher(name).group(1); + name = name.replace(File.separator, "."); + getLog().debug("Found class: " + name); + classNames.add(name); } } }