[ 
http://jira.codehaus.org/browse/MCLIRR-6?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_99985
 ] 

Jochen Wiedmann commented on MCLIRR-6:
--------------------------------------


Please verify, whether the following slightly modified patch works for you. 
(Cannot attach it, seems to be a Jira issue.)

Index: 
C:/Workspace/clirr-maven-plugin/src/main/java/org/codehaus/mojo/clirr/AbstractClirrMojo.java
===================================================================
--- 
C:/Workspace/clirr-maven-plugin/src/main/java/org/codehaus/mojo/clirr/AbstractClirrMojo.java
        (revision 4447)
+++ 
C:/Workspace/clirr-maven-plugin/src/main/java/org/codehaus/mojo/clirr/AbstractClirrMojo.java
        (working copy)
@@ -57,6 +57,7 @@
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -461,7 +462,21 @@
         }
     }
 
-    private static ClassLoader createClassLoader( Set artifacts, Set 
previousArtifacts )
+    /**
+     * Create a ClassLoader, which includes the artifacts in 
<code>artifacts</code>,
+     * but excludes the artifacts in <code>previousArtifacts</code>. The 
intention is,
+     * that we let BCEL inspect the artifacts in the latter set, using a
+     * [EMAIL PROTECTED] ClassLoader}, which contains the dependencies. 
However, the
+     * [EMAIL PROTECTED] ClassLoader} must not contain the jar files, which 
are being inspected.
+     * @param artifacts The artifacts, from which to build a [EMAIL PROTECTED] 
ClassLoader}.
+     * @param previousArtifacts The artifacts being inspected, or null, if te
+     *   returned [EMAIL PROTECTED] ClassLoader} should contain all the 
elements of
+     *   <code>artifacts</code>.
+     * @return A [EMAIL PROTECTED] ClassLoader} which may be used to inspect 
the classes in
+     *   [EMAIL PROTECTED] previousArtifacts}.
+     * @throws MalformedURLException Failed to convert a file to an URL.
+     */
+    private static ClassLoader createClassLoader( Collection artifacts, Set 
previousArtifacts )
         throws MalformedURLException
     {
         URLClassLoader cl = null;
@@ -471,7 +486,7 @@
             for ( Iterator i = artifacts.iterator(); i.hasNext(); )
             {
                 Artifact artifact = (Artifact) i.next();
-                if ( previousArtifacts != null && !previousArtifacts.contains( 
artifact ) )
+                if ( previousArtifacts == null || !previousArtifacts.contains( 
artifact ) )
                 {
                     urls.add( artifact.getFile().toURI().toURL() );
                 }
Index: C:/Workspace/clirr-maven-plugin/src/changes/changes.xml
===================================================================
--- C:/Workspace/clirr-maven-plugin/src/changes/changes.xml     (revision 4447)
+++ C:/Workspace/clirr-maven-plugin/src/changes/changes.xml     (working copy)
@@ -2,7 +2,15 @@
   <properties>
     <title>Changes in the Clirr Maven Plugin</title>
   </properties>
-  <body>
+  <body>
+    <release version="2.1.1" date="Not yet released">
+      <action dev="jochen" type="fix" due-to="Gr&#233;gory Joseph"
+          due-to-email="[EMAIL PROTECTED]" issue="MCLIRR-6">
+        A class loader with a plugins dependencies wasn't created
+        properly.
+      </action> 
+    </release>
+
     <release version="2.1" date="06-Jun-2007">
       <action dev="brett" type="fix" issue="MCLIRR-2">
         Add extra source directories under report generation since Maven does 
not corretly pass them on.
Index: C:/Workspace/clirr-maven-plugin/pom.xml
===================================================================
--- C:/Workspace/clirr-maven-plugin/pom.xml     (revision 4447)
+++ C:/Workspace/clirr-maven-plugin/pom.xml     (working copy)
@@ -61,9 +61,13 @@
       <email>[EMAIL PROTECTED]</email>
     </contributor>
     <contributor>
-      <name>Mathias Brökelmann</name>
+      <name>Mathias Br&#246;kelmann</name>
       <email>[EMAIL PROTECTED]</email>
     </contributor>
+    <contributor>
+      <name>Gr&#233;gory Joseph</name>
+      <email>[EMAIL PROTECTED]</email>
+    </contributor>
   </contributors>
 
   <dependencies>


> Classloader for current version not built properly
> --------------------------------------------------
>
>                 Key: MCLIRR-6
>                 URL: http://jira.codehaus.org/browse/MCLIRR-6
>             Project: Maven 2.x Clirr Plugin
>          Issue Type: Bug
>    Affects Versions: 2.1
>            Reporter: Grégory Joseph
>         Attachments: clirr-classloader.patch
>
>
> When trying to use the clirr mojo, I get ClassNotFoundExceptions, in exactly 
> the same vein as others have had [1]. After some debugging, I realized this 
> was due to the fact that clirr was fed with a classloader for the "current" 
> classes that missed the dependencies. The fix for this was pretty trivial 
> (see attachment), but one might want to change the condition at line 474 of 
> the createClassLoader() method instead.
> I might be doing something wrong, but I really don't see what; with this fix, 
> I get the expected report.
> [1] 
> http://www.google.com/search?q=%22at+org.apache.bcel.classfile.JavaClass.getAllInterfaces%28JavaClass.java%3A808%29%22

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to