Issue Details (XML | Word | Printable)

Key: MSITE-60
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Critical Critical
Assignee: Brett Porter
Reporter: Joakim Erdfelt
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Maven 2.x Site Plugin

Report Classloaders out of sync when executed from within the site:site goal.

Created: 28/Dec/05 02:23 PM   Updated: 12/Oct/08 01:44 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. File dummy-maven-plugin.tar.bz2 (2 kB)
2. Text File MNG-1901.patch (1.0 kB)

Issue Links:
Related
dependent
 


 Description  « Hide
When testing the classloaders from within a mojo and a report the following is discovered.
    1. Direct Mojo execution from command line.

mvn -e dummy:dump
Thread.currentThread().getContextClassLoader() = RealmDelegatingClassLoader for dummy:dump.
this.getClass().getClassLoader() = RealmClassLoader for dummy:dump.

    1. Report execution via site:site

mvn -e site:site
Thread.currentThread().getContextClassLoader() = RealmDelegatingClassLoader for site:site.
this.getClass().getClassLoader() = RealmClassLoader for dummy:report.

When a report is executing, relying on the Thread.currentThread().getContextClassLoader() to obtain resources out of jar files (for example) will fail.

This discovery was as a result of debugging MCHECKSTYLE-10



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Joakim Erdfelt added a comment - 28/Dec/05 02:29 PM
The classloader differences from within a Report vs a Mojo makes it difficult to find resources that are needed by the checkstyle plugin.

Either the Thread.currentThread().getContextClassLoader() should be the one for the specific report, or there should be a gotcha for report developers to use this.getClass().getClassLoader() instead.

But that kind of limitation could pose problems for classloader issues in non-reports, such as checkstyle internals, or commons-logging internals.


Joakim Erdfelt added a comment - 28/Dec/05 05:03 PM
Attached is a simple patch against the maven-site-plugin that corrects the classloader situation.

Vincent Siveton added a comment - 01/Feb/06 08:08 PM
I tried your dummy project with site goal (from trunk) and m2 2.0.2. All sounds good for me.
Do you think that we could close this issue?

Brett Porter added a comment - 07/Feb/06 07:18 AM
its not reproducible because the fix was added directly to the checkstyle plugin.

I think we resolved to fix this in the core eventually, and to work around it in individual plugins for now. Please reopen if I'm mistaken.