Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
When testing the classloaders from within a mojo and a report the following is discovered.
-
- Direct Mojo execution from command line.
mvn -e dummy:dump
Thread.currentThread().getContextClassLoader() = RealmDelegatingClassLoader for dummy:dump.
this.getClass().getClassLoader() = RealmClassLoader for dummy:dump.
-
- 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
Issue Links
- is depended upon by
-
MCHECKSTYLE-10
Exception when creating Checkstyle report as part of a 'site' build
-
- is related to
-
MNG-1898
Plugin classpath broken from 2.0 to 2.0.1
-
- relates to
-
MNG-2795
Classloader problem loading a resource from a build extension Jar : difference between 2.0.4 and (future) 2.0.5
-
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.