mirror of https://github.com/apache/maven.git
Fixed MNG-908: set the contextClassLoader to the classrealm of the
currently executing plugin, so that both getClass().getClassLoader() and Thread.currentThread().getContextClassLoader() return the same classloader (and hence resources). git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@290040 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
12916488b4
commit
7009b9e799
|
@ -352,8 +352,13 @@ public class DefaultPluginManager
|
|||
|
||||
dispatcher.dispatchStart( event, goalExecId );
|
||||
|
||||
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
try
|
||||
{
|
||||
Thread.currentThread().setContextClassLoader(
|
||||
mojoDescriptor.getPluginDescriptor().getClassRealm().getClassLoader() );
|
||||
|
||||
plugin.execute();
|
||||
|
||||
dispatcher.dispatchEnd( event, goalExecId );
|
||||
|
@ -366,6 +371,9 @@ public class DefaultPluginManager
|
|||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Thread.currentThread().setContextClassLoader( oldClassLoader );
|
||||
|
||||
try
|
||||
{
|
||||
PlexusContainer pluginContainer = getPluginContainer( mojoDescriptor.getPluginDescriptor() );
|
||||
|
|
|
@ -302,4 +302,10 @@ public class PluginDescriptor
|
|||
{
|
||||
this.classRealm = classRealm;
|
||||
}
|
||||
|
||||
public ClassRealm getClassRealm()
|
||||
{
|
||||
return classRealm;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue