Bug 1276729

Summary: xmvn: buiddep MOJO should cope better with immutable or broken projects
Product: [Fedora] Fedora Reporter: Michal Srb <msrb>
Component: xmvnAssignee: Mikolaj Izdebski <mizdebsk>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: java-sig-commits, mat.booth, mizdebsk, msimacek, msrb
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 2.5.0-5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-26 13:44:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Srb 2015-10-30 16:25:07 UTC
Description of problem:

Jenkins fails to build with new XMvn:

[ERROR] Failed to execute goal org.fedoraproject.xmvn:xmvn-mojo:2.5.0:builddep (default-cli) on project pom: Execution default-cli of goal org.fedoraproject.xmvn:xmvn-mojo:2.5.0:builddep failed. UnsupportedOperationException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.fedoraproject.xmvn:xmvn-mojo:2.5.0:builddep (default-cli) on project pom: Execution default-cli of goal org.fedoraproject.xmvn:xmvn-mojo:2.5.0:builddep failed.
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.fedoraproject.xmvn:xmvn-mojo:2.5.0:builddep failed.
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	... 20 more
Caused by: java.lang.UnsupportedOperationException
	at java.util.AbstractList.set(AbstractList.java:132)
	at java.util.AbstractList$ListItr.set(AbstractList.java:426)
	at org.fedoraproject.xmvn.model.impl.DefaultModelProcessor.visitBuildResource(DefaultModelProcessor.java:622)
	at org.fedoraproject.xmvn.model.impl.DefaultModelProcessor.visitBuild(DefaultModelProcessor.java:369)
	at org.fedoraproject.xmvn.model.impl.DefaultModelProcessor.visit(DefaultModelProcessor.java:311)
	at org.fedoraproject.xmvn.model.impl.DefaultModelProcessor.processModel(DefaultModelProcessor.java:83)
	at org.fedoraproject.xmvn.mojo.BuilddepMojo.execute(BuilddepMojo.java:145)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	... 21 more


Version-Release number of selected component (if applicable):
xmvn-2.5.0-2.fc24.noarch
javapackages-tools-4.6.0-8.fc24.noarch
java-1.8.0-openjdk-1.8.0.60-15.b28.fc24.x86_64

How reproducible:
always

Steps to Reproduce:
1. rebuild jenkins package in master from 961bbdcc
2.
3.

Comment 1 Mikolaj Izdebski 2015-10-30 18:26:06 UTC
Reproducible by running:

    xmvn -o -f core generate-sources org.fedoraproject.xmvn:xmvn-mojo:builddep

XMvn fails to work with ANTLR plugin because it returns immutable collection, but XMvn expects mutable list. This is a bug in Maven ANTLR Plugin. Its MavenProject implementation in DependencyProjectStub.java is buggy and violates contract of MavenProject - many methods have no implementations (empty method body), some setters do nothing, some getters return different value on each call (even if object was not modified).

I don't consider this as a bug in XMvn, but rather enhancement request - XMvn should cope better with immutable or buggy projects. Until this is implemented, I can suggest possible solutions/workarounds:

1. fix antlr-maven-plugin (note that upstream - Codehaus - is dead)
2. use a different plugin (eg. one from ANTLR upstream)
3. skip running builddep MOJO (requires calling xmvn manualy, not using %mvn_build)

Comment 2 Mikolaj Izdebski 2015-10-30 18:31:07 UTC
(In reply to Mikolaj Izdebski from comment #1)
> XMvn fails to work with ANTLR plugin because it returns immutable
> collection, but XMvn expects mutable list. This is a bug in Maven ANTLR
> Plugin. Its MavenProject implementation in DependencyProjectStub.java is
> buggy and violates contract of MavenProject - many methods have no
> implementations (empty method body), some setters do nothing, some getters
> return different value on each call (even if object was not modified).

I just realized the above description is not correct - I was looking at wrong class. Still, the problem is caused by ANTLR plugin.

Comment 3 Mat Booth 2015-11-18 09:59:48 UTC
antlr32 package suffers from this problem also:

https://apps.fedoraproject.org/koschei/package/antlr32

For now, I will switch to manual invocation of xmvn as suggested in comment 1

Comment 4 Mikolaj Izdebski 2015-11-26 13:33:28 UTC
Fixed in xmvn-2.5.0-5

Comment 5 Mikolaj Izdebski 2015-11-26 13:44:19 UTC
I believe that this bug is fixed in xmvn-2.5.0-5,
which is available in Fedora Rawhide, so I am closing this bug now.

The build containing the fix can be found at Koji:
http://koji.fedoraproject.org/koji/buildinfo?buildID=701753