You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Daniel Kulp <da...@iona.com> on 2007/03/12 15:57:07 UTC

ResourceManager issues in reporting plugins...

Jason,

Back in December, you changed a bunch of plugins (PMD and Checkstyle are 
definitely two of them) to use the ResourceManager instead of the custom 
Locator code they had. 

That seems to work fine when the plugins are part of the actual build 
build, but not during a reporting run.    If there are config files that 
are part of a dependency jar (obviously configured in pluginManagement 
section due to reporting section not having dependencies), during a 
regular build, the call to rm.getResourceAsFile(....) passing a "classpath 
relative" string works perfectly.

However, during a "mvn site" run, that ends up throwing an exception as the 
resource cannot be found.    For PMD, I explicitly catch the exception and 
then call "this.getClass().getClassLoader().getResource(....)" which DOES 
work.  Thus, I know the plugin itself is picking up the dependencies 
correctly.   It's just the ResourceManager that is not configured 
completely correctly.

Any ideas?   Is the thread contextClassloader not being set properly during 
reporting?

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: ResourceManager issues in reporting plugins...

Posted by Daniel Kulp <da...@iona.com>.
Quick updates:

1) It's definitely the classloader.   If a set the contextClassLoader to 
the classloader of the plugin, the RM works fine.  That seems like less of 
a hack so I'll go with that.

2) I THINK this is the cause of MCHECKSTYLE-65.   I'll try the classloader 
thing there too.


Dan



On Monday 12 March 2007 10:57, Daniel Kulp wrote:
> Jason,
>
> Back in December, you changed a bunch of plugins (PMD and Checkstyle are
> definitely two of them) to use the ResourceManager instead of the custom
> Locator code they had.
>
> That seems to work fine when the plugins are part of the actual build
> build, but not during a reporting run.    If there are config files that
> are part of a dependency jar (obviously configured in pluginManagement
> section due to reporting section not having dependencies), during a
> regular build, the call to rm.getResourceAsFile(....) passing a
> "classpath relative" string works perfectly.
>
> However, during a "mvn site" run, that ends up throwing an exception as
> the resource cannot be found.    For PMD, I explicitly catch the
> exception and then call
> "this.getClass().getClassLoader().getResource(....)" which DOES work. 
> Thus, I know the plugin itself is picking up the dependencies correctly.
>   It's just the ResourceManager that is not configured completely
> correctly.
>
> Any ideas?   Is the thread contextClassloader not being set properly
> during reporting?

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: ResourceManager issues in reporting plugins...

Posted by Daniel Kulp <da...@iona.com>.
Dennis,

On Monday 12 March 2007 12:04, Dennis Lundberg wrote:
> I stumbled upon this issue over the weekend. If you are using the trunk
> version from svn of the Checkstyle plugin, you cannot build the site for
> any of our own plugins. I managed to work around it by explicitly
> specifying maven-checkstyle-plugin version 2.1 temporarily in the pom. I
> got the same message as in MCHECKSTYLE-65.

I deployed a new snapshot about an hour ago that I fixes this problem.  (it 
was breaking the builds of some projects like Apache Yoko which use 
snapshots)   I moved the setting of the contextClassLoader to before 
resolving the locations of the various files.   That seems to fix the 
issue most of the time.   I'm having some issues with the suppression 
files, but I hope to have that fixed in the next 1/2 hour or so.

Dan

> Daniel Kulp wrote:
> > Jason,
> >
> > Back in December, you changed a bunch of plugins (PMD and Checkstyle
> > are definitely two of them) to use the ResourceManager instead of the
> > custom Locator code they had.
> >
> > That seems to work fine when the plugins are part of the actual build
> > build, but not during a reporting run.    If there are config files
> > that are part of a dependency jar (obviously configured in
> > pluginManagement section due to reporting section not having
> > dependencies), during a regular build, the call to
> > rm.getResourceAsFile(....) passing a "classpath relative" string works
> > perfectly.
> >
> > However, during a "mvn site" run, that ends up throwing an exception
> > as the resource cannot be found.    For PMD, I explicitly catch the
> > exception and then call
> > "this.getClass().getClassLoader().getResource(....)" which DOES work. 
> > Thus, I know the plugin itself is picking up the dependencies
> > correctly.   It's just the ResourceManager that is not configured
> > completely correctly.
> >
> > Any ideas?   Is the thread contextClassloader not being set properly
> > during reporting?

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: ResourceManager issues in reporting plugins...

Posted by Dennis Lundberg <de...@apache.org>.
I stumbled upon this issue over the weekend. If you are using the trunk 
version from svn of the Checkstyle plugin, you cannot build the site for 
any of our own plugins. I managed to work around it by explicitly 
specifying maven-checkstyle-plugin version 2.1 temporarily in the pom. I 
got the same message as in MCHECKSTYLE-65.

Daniel Kulp wrote:
> Jason,
> 
> Back in December, you changed a bunch of plugins (PMD and Checkstyle are 
> definitely two of them) to use the ResourceManager instead of the custom 
> Locator code they had. 
> 
> That seems to work fine when the plugins are part of the actual build 
> build, but not during a reporting run.    If there are config files that 
> are part of a dependency jar (obviously configured in pluginManagement 
> section due to reporting section not having dependencies), during a 
> regular build, the call to rm.getResourceAsFile(....) passing a "classpath 
> relative" string works perfectly.
> 
> However, during a "mvn site" run, that ends up throwing an exception as the 
> resource cannot be found.    For PMD, I explicitly catch the exception and 
> then call "this.getClass().getClassLoader().getResource(....)" which DOES 
> work.  Thus, I know the plugin itself is picking up the dependencies 
> correctly.   It's just the ResourceManager that is not configured 
> completely correctly.
> 
> Any ideas?   Is the thread contextClassloader not being set properly during 
> reporting?
> 


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org