You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "John Allen (JIRA)" <ji...@codehaus.org> on 2007/07/11 18:55:13 UTC

[jira] Issue Comment Edited: (MCLOVER-71) Cannot resolve license file

    [ http://jira.codehaus.org/browse/MCLOVER-71?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_101938 ] 

John Allen edited comment on MCLOVER-71 at 7/11/07 11:53 AM:
-------------------------------------------------------------

Re - using a dependency artifact to deliver the license file:

Okay, assuming everyone already knows about the hack of defining the clover plugin in the <build><plugins> scope and providing it with its own plugin <dependencies> that causes maven to initialise the plugin but not run any of its mojos (it has no default mojo) and that when site runs it will use the already configured-and-initialised clover plugin (including these dependencies) from the build scope to run the report mojo, which will in turn magically have the required JAR artifact containing the licenseLocation resource in it, which in turn will be searched by the plexuse-resource RecourceManager (breath) then the only issue is that there is a bug that still prevents this from working.

Namely that the plexus-resources ResourceManager only  searches the ThreadContextClassLoader and the SystemClassLoader for resources and unlike Checkstyle and PMD, Clover does not change the Thread Context CL to be its equal to this.getClass().getClassLoader().

So clover is simply missing this line in AbstractCloverMojo:registerLicenseFile +156

                Thread.currentThread().setContextClassLoader( this.getClass().getClassLoader() );

One could set it back after too I expect. We are in the process of patching and testing and will submit patch as soon as proven.




 was:
Okay, assuming everyone already knows about the hack of defining the clover plugin in the <build><plugins> scope and providing it with its own plugin <dependencies> that causes maven to initialise the plugin but not run any of its mojos (it has no default mojo) and that when site runs it will use the already configured-and-initialised clover plugin (including these dependencies) from the build scope to run the report mojo, which will in turn magically have the required JAR artifact containing the licenseLocation resource in it, which in turn will be searched by the plexuse-resource RecourceManager (breath) then the only issue is that there is a bug that still prevents this from working.

Namely that the plexus-resources ResourceManager only  searches the ThreadContextClassLoader and the SystemClassLoader for resources and unlike Checkstyle and PMD, Clover does not change the Thread Context CL to be its equal to this.getClass().getClassLoader().

So clover is simply missing this line in AbstractCloverMojo:registerLicenseFile +156

                Thread.currentThread().setContextClassLoader( this.getClass().getClassLoader() );

One could set it back after too I expect. We are in the process of patching and testing and will submit patch as soon as proven.



> Cannot resolve license file
> ---------------------------
>
>                 Key: MCLOVER-71
>                 URL: http://jira.codehaus.org/browse/MCLOVER-71
>             Project: Maven 2.x Clover Plugin
>          Issue Type: Bug
>    Affects Versions: 2.4
>            Reporter: Bryan Madsen
>
> The license file cannot be found when the license location is a URL. This works with version 2.3.
> [INFO] [clover:instrumentInternal]
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] ------------------------------------------------------------------------
> [INFO] Failed to load license file [http://scm.apparch.cerner.corp/svn/apparch/licenses/clover.license]
> Embedded error: Could not find resource 'http://scm.apparch.cerner.corp/svn/apparch/licenses/clover.license'.
> [INFO] ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to load license file [http://scm.apparch.cerner.corp/svn/apparch/licenses/clover.license]
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:896)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:739)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:510)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
> 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
> 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> 	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> 	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> 	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to load license file [http://scm.apparch.cerner.corp/svn/apparch/licenses/clover.license]
> 	at org.apache.maven.plugin.clover.internal.AbstractCloverMojo.registerLicenseFile(AbstractCloverMojo.java:164)
> 	at org.apache.maven.plugin.clover.internal.AbstractCloverMojo.registerLicenseFile(AbstractCloverMojo.java:134)
> 	at org.apache.maven.plugin.clover.internal.AbstractCloverMojo.execute(AbstractCloverMojo.java:119)
> 	at org.apache.maven.plugin.clover.CloverInstrumentInternalMojo.execute(CloverInstrumentInternalMojo.java:132)
> 	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
> 	... 20 more
> Caused by: org.codehaus.plexus.resource.loader.ResourceNotFoundException: Could not find resource 'http://scm.apparch.cerner.corp/svn/apparch/licenses/clover.license'.
> 	at org.codehaus.plexus.resource.DefaultResourceManager.getResourceAsInputStream(DefaultResourceManager.java:91)
> 	at org.codehaus.plexus.resource.DefaultResourceManager.getResourceAsFile(DefaultResourceManager.java:117)
> 	at org.codehaus.plexus.resource.DefaultResourceManager.getResourceAsFile(DefaultResourceManager.java:100)
> 	at org.apache.maven.plugin.clover.internal.AbstractCloverMojo.registerLicenseFile(AbstractCloverMojo.java:159)
> 	... 25 more

-- 
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