Bug 1316994

Summary: java.lang.RuntimeException: java.util.zip.ZipException: duplicate entry: when building kxml
Product: Red Hat Software Collections Reporter: Severin Gehwolf <sgehwolf>
Component: xmvnAssignee: Mikolaj Izdebski <mizdebsk>
Status: CLOSED ERRATA QA Contact: Jan Kepler <jkejda>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rh-maven35CC: jkejda, jorton
Target Milestone: alpha   
Target Release: 3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rh-maven35-xmvn-3.0.0-5.2.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-24 09:53:38 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:
Bug Depends On:    
Bug Blocks: 1448496    
Attachments:
Description Flags
kxml2 compat package spec with failing %mvn_install macro
none
Reproducer none

Description Severin Gehwolf 2016-03-11 16:34:06 UTC
Created attachment 1135303 [details]
kxml2 compat package spec with failing %mvn_install macro

Description of problem:
When attempting to build kxml as a compat package, xmvn fails in the install phase with:

DEBUG] Assigning installer for each installable artifact
[DEBUG] Installing artifacts
[DEBUG] Installing net.sf.kxml:kxml2:pom:2.3.0 using org.fedoraproject.xmvn.tools.install.impl.DefaultArtifactInstaller
[TRACE] Native code not found inside /builddir/build/SOURCES/kxml2-2.3.0.pom
[TRACE] Trying to inject manifest to net.sf.kxml:kxml2:pom:2.3.0
[TRACE] Manifest injection skipped: no pre-existing manifest found to update
[INFO] Installing artifact net.sf.kxml:kxml2:pom:2.3.0
[DEBUG] Installing net.sf.kxml:kxml2:jar:2.3.0 using org.fedoraproject.xmvn.tools.install.impl.DefaultArtifactInstaller
[TRACE] Native code not found inside /builddir/build/BUILD/kxml-2.3.0/dist/kxml2-2.3.0.jar
[TRACE] Trying to inject manifest to net.sf.kxml:kxml2:jar:2.3.0
[TRACE] Injected field JavaPackages-GroupId: net.sf.kxml
[TRACE] Injected field JavaPackages-ArtifactId: kxml2
[TRACE] Not injecting field JavaPackages-Extension (it has default value "jar")
[TRACE] Not injecting field JavaPackages-Classifier (it has default value "")
[TRACE] Injected field JavaPackages-Version: 2.3.0
Unhandled exception
java.lang.RuntimeException: java.util.zip.ZipException: duplicate entry: META-INF/services/org.xmlpull.v1.XmlPullParserFactory
	at org.fedoraproject.xmvn.tools.install.impl.JarUtils.injectManifest(JarUtils.java:213)
	at org.fedoraproject.xmvn.tools.install.impl.DefaultArtifactInstaller.install(DefaultArtifactInstaller.java:82)
	at org.fedoraproject.xmvn.tools.install.impl.DefaultInstaller.installArtifact(DefaultInstaller.java:235)
	at org.fedoraproject.xmvn.tools.install.impl.DefaultInstaller.install(DefaultInstaller.java:345)
	at org.fedoraproject.xmvn.tools.install.cli.InstallerCli.run(InstallerCli.java:53)
	at org.fedoraproject.xmvn.tools.install.cli.InstallerCli.main(InstallerCli.java:72)
Caused by: java.util.zip.ZipException: duplicate entry: META-INF/services/org.xmlpull.v1.XmlPullParserFactory
	at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:232)
	at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109)
	at org.fedoraproject.xmvn.tools.install.impl.JarUtils.injectManifest(JarUtils.java:203)
	... 5 more
RPM build errors:
error: Bad exit status from /var/tmp/rpm-tmp.TZHhK0 (%install)
    Bad exit status from /var/tmp/rpm-tmp.TZHhK0 (%install)
Child return code was: 1
EXCEPTION: Command failed. See logs for output.
 # bash --login -c /usr/bin/rpmbuild -bb --target x86_64 --nodeps  /builddir/build/SPECS/kxml2.spec 
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/mockbuild/trace_decorator.py", line 88, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3.4/site-packages/mockbuild/util.py", line 547, in do
    raise exception.Error("Command failed. See logs for output.\n # %s" % (command,), child.returncode)
mockbuild.exception.Error: Command failed. See logs for output.
 # bash --login -c /usr/bin/rpmbuild -bb --target x86_64 --nodeps  /builddir/build/SPECS/kxml2.spec 
LEAVE do --> EXCEPTION RAISED

The spec file I've used is attached. It seems maven30-xmvn needs a backport of:
https://github.com/mizdebsk/xmvn/commit/9a326bd401d3f82ce09be69fec55d48fb39d3bea

An SRPM and full log of the failure is here:
https://copr.fedorainfracloud.org/coprs/jerboaa/thermostat-latest/build/167520/

Comment 4 Mikolaj Izdebski 2017-10-05 09:20:47 UTC
Created attachment 1334726 [details]
Reproducer

java -cp $(build-classpath xmvn objectweb-asm slf4j/api slf4j/simple):rep.jar rep.DuplicateManifestReproducer rep.jar

Comment 7 errata-xmlrpc 2017-10-24 09:53:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:3022