maven-service-plugin/src/main/java/org/lcsim
diff -u -r1.6 -r1.7
--- MavenServicePluginMojo.java 10 Sep 2008 22:07:14 -0000 1.6
+++ MavenServicePluginMojo.java 10 Sep 2008 22:38:39 -0000 1.7
@@ -28,7 +28,7 @@
/**
* Directory to scan for classes implementing service, which defaults to project's build output directory.
*
- * @parameter expression="scanDir=${project.build.outputDirectory}"
+ * @parameter expression="${project.build.outputDirectory}"
*/
private String scanDir;
@@ -43,7 +43,7 @@
/**
* Output directory where services file is placed, which defaults to standard resources area.
*
- * @parameter expression="outputDirectory=${basedir}/src/main/resources/META-INF/services"
+ * @parameter expression="${basedir}/src/main/resources/META-INF/services"
*/
private String outputDirectory;
@@ -94,18 +94,11 @@
{
urlsArr[i] = urls.get(i);
}
- loader = new MyURLClassLoader(urlsArr);
-
- // DEBUG: print out class path entries
- //System.out.println("created class path ...");
- //for (URL url : loader.getURLs())
- //{
- // System.out.println(url.toString());
- //}
+ loader = new MyURLClassLoader(urlsArr);
}
public void execute() throws MojoExecutionException
- {
+ {
if (className == null) throw new RuntimeException("className not set");
if (outputDirectory == null) throw new RuntimeException("outputDirectory not set");
@@ -129,6 +122,11 @@
ServiceDirWalker dirWalk = new ServiceDirWalker(new ClassFileFilter(), -1);
Collection drivers = new ArrayList();
dirWalk.walkIt(new File(scanDir), drivers);
+
+ for (Object o : drivers)
+ {
+ o.toString();
+ }
// Add results of search to services file.
try {
@@ -160,21 +158,23 @@
public ServiceDirWalker(FileFilter filter, int depth)
{
super(filter, depth);
- }
+ }
public void handleFile(File file, int depth, Collection results)
- {
+ {
try {
// Load the class.
Class klass =
- loader.loadClass(file.getCanonicalPath().replace(baseDir.getCanonicalPath(),"").replace(".class","").replace("/",".").substring(1));
+ loader.loadClass(file.getCanonicalPath().replace(baseDir.getCanonicalPath(),"").replace(".class","").replace("/",".").substring(1));
// Check if service class is a superclass.
if (serviceClass.isAssignableFrom(klass))
{
// Add to results if this isn't a nested class.
if (!klass.getName().contains("$"))
+ {
results.add(klass);
+ }
}
}
catch (Exception x)