Dear devs,
I would like confirmation that what I am doing is wrong, stupid and foolish
and potentially should be detected and prevented by mvn.
I have a corp pom that binds checkstyle and pmd to validate phase. Both
these plugins have an extra config jar artifact added as a plugin dependency
that contains their config files. However the config artifact is itself
built in the same reactor as the corp pom and is also a snapshot. My first
observation is that isnt this a cyclic reference? Checkstyle and pmd both
get invoked before the config artifact is itself built in the reactor and so
with a fresh local repo and no deployment of the config jar the build would
fail to resolve.
Should this be detected by mvn and prevented?
However as I do have it in the local repo so the build runs.
What happens next I guess could be called 'unspecified behaviour'. Running
the build from the command line everything works pretty much all of the time
(had one or two failures, see later) but when my build is run from Hudson i
have a flip-flop situation, with no changes to the code base, simply running
the build repeatedly results in ~ two successes followed by a failure then
back to two success. Timing seems to be an issue too (shrug).
Looking at the errors produced by checkstyle and pmd (they are different),
checkstyle states it can not find it's config (usually found via the TLCCL
via the plexus-resources code) and pmd barfs with either a:
[INFO] An error has occurred in PMD Report report generation.
Embedded error: Cannot create file-based resource.
oversubscribed dynamic bit lengths tree
[INFO]
------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: An error has
occurred in PMD Report report generation.
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at
org.apache.maven.lifecycle.LifecycleExecutorInterceptor.execute(LifecycleExecutorInterceptor.java:42)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
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 hudson.maven.agent.Main.launch(Main.java:134)
at hudson.maven.MavenBuilder.call(MavenBuilder.java:139)
at
hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:542)
at
hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:488)
at hudson.remoting.UserRequest.perform(UserRequest.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:23)
at hudson.remoting.Request$2.run(Request.java:213)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.maven.plugin.MojoExecutionException: An error has
occurred in PMD Report report generation.
at
org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:79)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at
hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:159)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
... 28 more
Caused by: org.apache.maven.reporting.MavenReportException: Cannot create
file-based resource.
at
org.apache.maven.plugin.pmd.PmdReport.executeReport(PmdReport.java:199)
at
org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:98)
at
org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:73)
... 31 more
Caused by:
org.codehaus.plexus.resource.loader.FileResourceCreationException: Cannot
create file-based resource.
at
org.codehaus.plexus.resource.DefaultResourceManager.getResourceAsFile(DefaultResourceManager.java:154)
at
org.apache.maven.plugin.pmd.PmdReport.executeReport(PmdReport.java:178)
... 33 more
Caused by: java.util.zip.ZipException: oversubscribed dynamic bit lengths
tree
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:140)
at java.io.FilterInputStream.read(FilterInputStream.java:111)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.Reader.read(Reader.java:122)
at org.codehaus.plexus.util.IOUtil.copy(IOUtil.java:212)
at org.codehaus.plexus.util.IOUtil.copy(IOUtil.java:200)
at
org.codehaus.plexus.resource.DefaultResourceManager.getResourceAsFile(DefaultResourceManager.java:150)
... 34 more
or a ...
[DEBUG] The resource 'pmd/normal-pmd-rules.xml' found using the
[EMAIL PROTECTED]
[Fatal Error] :1:1: Content is not allowed in prolog.
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:98)
at
net.sourceforge.pmd.RuleSetFactory.parseRuleSetNode(RuleSetFactory.java:190)
at
net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:157)
at
net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:146)
at
org.apache.maven.plugin.pmd.PmdReport.executeReport(PmdReport.java:186)
at
org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:98)
at
org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:73)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at
hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:159)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at
org.apache.maven.lifecycle.LifecycleExecutorInterceptor.execute(LifecycleExecutorInterceptor.java:42)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
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 hudson.maven.agent.Main.launch(Main.java:134)
at hudson.maven.MavenBuilder.call(MavenBuilder.java:139)
at
hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:542)
at
hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:488)
at hudson.remoting.UserRequest.perform(UserRequest.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:23)
at hudson.remoting.Request$2.run(Request.java:213)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
[PMD] A total of 0 annotations have been found for priority HIGH
[PMD] A total of 0 annotations have been found for priority NORMAL
[PMD] A total of 0 annotations have been found for priority LOW
So bottom line question, what is the specified behaviour for what I'm doing?
Does maven try and do anything clever replacing artifacts in the build with
ones that have just been created in the reactor? Does anyone have any
suggestions on how best to sort this chicken and egg issue? My corp pom also
sets up defaults for scm, distrMgt and a bunch of other stuff. I suppose I
could make the config artifact completely stand-alone, duplicating the corp
pom static stuff in its pom so its no longer involved in the reactor.
Thoughts, comments and admonishments welcome,
John
--
View this message in context:
http://www.nabble.com/Plugin-dependencies-and-suspected-cyclic-references-tp20760213p20760213.html
Sent from the Maven Developers mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]