Bug 1078967 - xmvn: generates bad reactor file from maven-jar-plugin with classifier
Summary: xmvn: generates bad reactor file from maven-jar-plugin with classifier
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: xmvn
Version: rawhide
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
Assignee: Mikolaj Izdebski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-20 15:57 UTC by Pete MacKinnon
Modified: 2014-04-01 10:49 UTC (History)
5 users (show)

Fixed In Version: 1.5.0-0.24.gitcb3a0a6
Clone Of:
Environment:
Last Closed: 2014-04-01 10:40:19 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
effective pom generated from mvn help:effective-pom -f <path-to-pom> (34.63 KB, text/plain)
2014-03-20 15:57 UTC, Pete MacKinnon
no flags Details
reproducer (9.34 KB, application/x-rpm)
2014-03-20 16:02 UTC, Mikolaj Izdebski
no flags Details

Description Pete MacKinnon 2014-03-20 15:57:33 UTC
Created attachment 876929 [details]
effective pom generated from mvn help:effective-pom -f <path-to-pom>

A maven-jar-plugin configuration that includes a classifier like this:

<plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <classifier>hadoop${hadoop.profile}</classifier>
        </configuration>
      </plugin>

leads to a bad file entry being generated in the .xmvn-reactor file:

  <artifact>
    <groupId>org.apache.sqoop</groupId>
    <artifactId>execution</artifactId>
    <extension>pom</extension>
    <version>1.99.3</version>
    <rawPomPath>/home/pmackinn/rpmbuild/BUILD/sqoop-1.99.3/execution/pom.xml</rawPomPath>
    <effectivePomPath>/tmp/xmvn6133786444662127620.pom.xml</effectivePomPath>
  </artifact>
  <artifact>
    <groupId>org.apache.sqoop.execution</groupId>
    <artifactId>sqoop-execution-mapreduce</artifactId>
    <version>1.99.3</version>
    <file>/home/pmackinn/rpmbuild/BUILD/sqoop-1.99.3/execution/mapreduce/target/classes</file>
    <rawPomPath>/home/pmackinn/rpmbuild/BUILD/sqoop-1.99.3/execution/mapreduce/pom.xml</rawPomPath>
    <effectivePomPath>/tmp/xmvn6994462136357679764.pom.xml</effectivePomPath>
  </artifact>
  <artifact>
    <groupId>org.apache.sqoop.execution</groupId>
    <artifactId>sqoop-execution-mapreduce</artifactId>
    <classifier>hadoop200</classifier>
    <version>1.99.3</version>
    <file>/home/pmackinn/rpmbuild/BUILD/sqoop-1.99.3/execution/mapreduce/target/sqoop-execution-mapreduce-1.99.3-hadoop200.jar</file>
  </artifact>

Comment 1 Mikolaj Izdebski 2014-03-20 16:02:16 UTC
Created attachment 876931 [details]
reproducer

Steps to reproduce:
mock maven-downloader-1.1-5.fc20.src.rpm

Actual results:
+ xmvn-install -R .xmvn-reactor -n maven-downloader -d /builddir/build/BUILDROOT/maven-downloader-1.1-5.fc21.x86_64
Unhandled exception
java.lang.RuntimeException: Failed to install project
	at org.fedoraproject.xmvn.tools.install.impl.DefaultInstaller.install(DefaultInstaller.java:415)
	at org.fedoraproject.xmvn.tools.install.InstallerCli.run(InstallerCli.java:142)
	at org.fedoraproject.xmvn.tools.install.InstallerCli.main(InstallerCli.java:156)
Caused by: java.io.IOException: Is a directory
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
	at sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:46)
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
	at sun.nio.ch.IOUtil.read(IOUtil.java:197)
	at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:149)
	at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
	at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109)
	at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
	at java.io.FilterInputStream.read(FilterInputStream.java:133)
	at java.io.PushbackInputStream.read(PushbackInputStream.java:186)
	at java.util.zip.ZipInputStream.readFully(ZipInputStream.java:424)
	at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:277)
	at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:121)
	at org.fedoraproject.xmvn.tools.install.impl.JarUtils.usesNativeCode(JarUtils.java:84)
	at org.fedoraproject.xmvn.tools.install.impl.DefaultInstaller.installArtifact(DefaultInstaller.java:286)
	at org.fedoraproject.xmvn.tools.install.impl.DefaultInstaller.install(DefaultInstaller.java:392)
	... 2 more

.xmvn-reactor file contains:
<?xml version="1.0" encoding="US-ASCII"?>
<!-- Reactor installation plan generated by XMvn -->
<reactorInstallationPlan>
  <artifact>
    <groupId>org.apache.maven.shared</groupId>
    <artifactId>maven-downloader</artifactId>
    <version>1.1</version>
    <file>/builddir/build/BUILD/maven-downloader-1.1/target/classes</file>
    <stereotype>jar</stereotype>
  </artifact>
  ...

$ rpm -q xmvn
xmvn-2.0.0-0.168.git95bc9a3.noarch

Comment 2 Pete MacKinnon 2014-03-27 15:48:37 UTC
Unfortunately the workaround of removing the classifier config eventually breaks the sqoop build I'm working on.

Comment 3 Mikolaj Izdebski 2014-03-28 11:15:40 UTC
Fix and unit test commited upstream.

Fix:
https://github.com/mizdebsk/xmvn/commit/c89394ded6f51aa53a1490cfba75084ad9927ed1

Test:
https://github.com/mizdebsk/xmvn/commit/ea5bb3291632df508c1ada40d31fd9c48d2ee569

Verified upstream.

Without the fix:

Running org.fedoraproject.xmvn.mojo.DirectoryInstallationTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.229 sec <<< FAILURE! - in org.fedoraproject.xmvn.mojo.DirectoryInstallationTest
testDirectoryAsProjectFile(org.fedoraproject.xmvn.mojo.DirectoryInstallationTest)  Time elapsed: 0.149 sec  <<< FAILURE!
java.lang.AssertionError: 
  Unexpected method call Deployer.deploy(org.fedoraproject.xmvn.deployer.DeploymentRequest@ac12c78e):
    Deployer.deploy(isA(org.fedoraproject.xmvn.deployer.DeploymentRequest)): expected: 1, actual: 2
	at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:44)
	at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:94)
	at com.sun.proxy.$Proxy10.deploy(Unknown Source)
	at org.fedoraproject.xmvn.mojo.InstallMojo.deployArtifact(InstallMojo.java:153)
	at org.fedoraproject.xmvn.mojo.InstallMojo.execute(InstallMojo.java:185)
	at org.fedoraproject.xmvn.mojo.DirectoryInstallationTest.testDirectoryAsProjectFile(DirectoryInstallationTest.java:100)

With the fix:

Running org.fedoraproject.xmvn.mojo.DirectoryInstallationTest
[main] INFO org.fedoraproject.xmvn.mojo.InstallMojo - Skipping installation of artifact /tmp/xmvn-test6026120378042784621: artifact file is not a regular file
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.189 sec - in org.fedoraproject.xmvn.mojo.DirectoryInstallationTest

Artifact file which is a directory is skipped with a message printed.

Comment 4 Mikolaj Izdebski 2014-03-28 16:05:58 UTC
Fixed in xmvn-1.5.0-0.23.gitcb3a0a6

Comment 6 Mikolaj Izdebski 2014-03-28 18:43:23 UTC
Fixed in xmvn-1.5.0-0.24.gitcb3a0a6

Comment 7 Mikolaj Izdebski 2014-04-01 10:40:19 UTC
I believe that this bug is fixed in xmvn-1.5.0-0.24.gitcb3a0a6,
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=507521


Note You need to log in before you can comment on or make changes to this bug.