Description of problem: A POM artifact that calls the assembly plugin to generate a jar file results in the jar file getting installed as the pom file, and when the pom file attempts to be copied xmvn files with a: java.nio.file.FileAlreadyExistsException Version-Release number of selected component (if applicable): xmvn-0:1.0.2-2.fc21.noarch How reproducible: 100% Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
This is not a bug in XMvn. It is a bug in Maven Jar Plugin. Reassigning. Reproducer: $ cat <<EOF >pom.xml <project> <modelVersion>4.0.0</modelVersion> <groupId>org.fedoraproject.xmvn.it</groupId> <artifactId>rhbz1012059</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>war</packaging> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <id>jar</id> <phase>package</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project> EOF $ mkdir -p src/main/webapp/WEB-INF $ touch src/main/webapp/WEB-INF/web.xml $ mvn clean install Actual results: 1) JAR file is installed with "war" extension: [INFO] Installing /home/kojan/git/xmvn/rep/target/rhbz1012059-1.0.0-SNAPSHOT.jar to /home/kojan/.m2/repository/org/fedoraproject/xmvn/it/rhbz1012059/1.0.0-SNAPSHOT/rhbz1012059-1.0.0-SNAPSHOT.war 2) WAR file is not installed at all Expected results: Both JAR and WAR files are installed with correct extensions
Created attachment 803249 [details] Proposed patch
Created attachment 803251 [details] Corrected patch
In reproducer, you are binding both jar and war plugins to the same phase of a build lifecycle. Since jar plugin is executed after war plugin it sets the project's main artifact. You can try to run jar plugin in prepare-package phase (or explicitly specify maven-war-plugin after the jar plugin in your pom file). Only war file will be installed and I think it's a correct behavior. I don't consider it a bug in maven-jar-plugin. Reassigning back to XMvn.
(In reply to Michal Srb from comment #4) > In reproducer, you are binding both jar and war plugins to the same phase of > a build lifecycle. Since jar plugin is executed after war plugin it sets the > project's main artifact. You can try to run jar plugin in prepare-package > phase (or explicitly specify maven-war-plugin after the jar plugin in your > pom file). Only war file will be installed and I think it's a correct > behavior. I don't consider it a bug in maven-jar-plugin. Reassigning back to > XMvn. My reproducer doesn't even use XMvn, so this has nothing to do with XMvn. Multiple plugins can be bound to the same phase, that's not a problem. And this problen is reproducible even if you bind JAR and WAR plugins to different phases. This really is a problem in Maven JAR Plugin.
(In reply to Mikolaj Izdebski from comment #5) > My reproducer doesn't even use XMvn, so this has nothing to do with XMvn. This bug is about hadoop failing to build, so XMvn is not out of the game. > Multiple plugins can be bound to the same phase, that's not a problem. And > this problen is reproducible even if you bind JAR and WAR plugins to > different phases. This really is a problem in Maven JAR Plugin. I am not saying it's not possible, but could you please provide such a reproducer where you bind jar plugin before war plugin and wrong artifact end up being installed? Otherwise if you specify jar plugin after war plugin project's main artifact will be set to jar file. That's how maven-jar-plugin behaves and I don't want to change this behavior, at least not without discussing it with upstream. And moreover, I really don't consider it a bug, maven just doesn't protect you from misconfiguring of your project. And I think you're missing one important detail here. Speaking of hadoop bug now. That one jar set as a main artifact of pom-only project should be build, but it's not supposed to be installed. XMvn should, in my opinion, check if packaging type is "pom" and if it is, then install only pom file and all attached artifacts, but not the main one. At least that's what maven-install-plugin does, if I remember correctly.
(In reply to Michal Srb from comment #6) > This bug is about hadoop failing to build, so XMvn is not out of the game. Ok. I will file a separate bug report. Closing this as WONTFIX. Described behavior of XMvn is expected.