This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1012913 - maven-jar-plugin: replaces project artifact if no classifier is specified
maven-jar-plugin: replaces project artifact if no classifier is specified
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: maven-jar-plugin (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Michal Srb
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-27 07:21 EDT by Mikolaj Izdebski
Modified: 2013-09-30 02:02 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1012059
Environment:
Last Closed: 2013-09-30 02:02:20 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Mikolaj Izdebski 2013-09-27 07:21:24 EDT
+++ This bug was initially created as a clone of Bug #1012059 +++

Maven JAR Plugin replaces project classifier with JAR file it produces if the JAR has no classifier specified.

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
Comment 1 Mikolaj Izdebski 2013-09-27 07:23:06 EDT
(In reply to Mikolaj Izdebski from comment #0)
> Maven JAR Plugin replaces project classifier with JAR file it produces if
> the JAR has no classifier specified.

This should be "replaces project *artifact file*"
Comment 2 Michal Srb 2013-09-30 02:02:20 EDT
I did some more testing and I noticed this:

$ 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>jar</packaging>     
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <executions>
                    <execution>
                        <id>war</id>
                        <phase>package</phase>
                        <goals>
                            <goal>war</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


Result:
[INFO] Installing /tmp/jar-plugin/target/rhbz1012059-1.0.0-SNAPSHOT.war to /home/msrb/.m2/repository/org/fedoraproject/xmvn/it/rhbz1012059/1.0.0-SNAPSHOT/rhbz1012059-1.0.0-SNAPSHOT.jar

So maven-war-plugin behaves the same. This makes me believe that this is expected behavior for plugins commonly used during package phase. Note you can change project's configuration to get desired result. From my POV it's not a bug.

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