Maven 2.x WAR Plugin

Maven-war-plugin not installing war. Installs ".jar" and renames it to ".war"

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Windows XP
    Maven 2.0.7
    JDK 1.5.0_10
  • Number of attachments :
    1

Description

I'm trying to use the maven-war-plugin to install a war into my local repository. "mvn clean install" runs fine and completes succesfully. If I look under the target" directory in the project folder, there is, amoung other things, a .jar and .war file. Both have been built properly. However, if I look in my local repository, there is a .war file but when I open it, it is actually the .jar file renamed to .war.

The attached zip file contains the pom for the project, the parent pom and the output from the command "mvn clean install -X > output.log"

Activity

Hide
Stephane Nicoll added a comment -

Not an issue. The definition of the jar plugin in the parent pom conflicts with war

Show
Stephane Nicoll added a comment - Not an issue. The definition of the jar plugin in the parent pom conflicts with war
Hide
Eric Smalling added a comment -

FYI: We've found that if you add a classifier to the jar that causes the filename to differ from the .war file, the install:install step will grab both and not exhibt the issue described here.

i.e.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>my-web-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>something</classifier>
</configuration>
</execution>
</executions>
</plugin>

(Although a better solution is to refactor your jar content into a "common" module though)

Show
Eric Smalling added a comment - FYI: We've found that if you add a classifier to the jar that causes the filename to differ from the .war file, the install:install step will grab both and not exhibt the issue described here. i.e. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <id>my-web-jar</id> <phase>package</phase> <goals> <goal>jar</goal> </goals> <configuration> <classifier>something</classifier> </configuration> </execution> </executions> </plugin> (Although a better solution is to refactor your jar content into a "common" module though)
Hide
rich zaleski added a comment -

It would be great if this would be fixed. It seems the maven-source-plugin works properly, but the maven-war-plugin does not. I would like to generate primary and secondary artifacts using a single pom file. It seems overly complex to have to make modules out of everything.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>cds_commons</warName>
</configuration>
<executions>
<execution>
<id>attach-war</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
< /plugins>
</build>

Show
rich zaleski added a comment - It would be great if this would be fixed. It seems the maven-source-plugin works properly, but the maven-war-plugin does not. I would like to generate primary and secondary artifacts using a single pom file. It seems overly complex to have to make modules out of everything. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <id>default-jar</id> <phase>package</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <warName>cds_commons</warName> </configuration> <executions> <execution> <id>attach-war</id> <phase>package</phase> <goals> <goal>war</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <executions> <execution> <id>attach-sources</id> <phase>package</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> < /plugins> </build>
Hide
Wendy Smoak added a comment -

Rich, this issue is already closed as "Won't Fix" indicating that the developers don't consider it a valid bug. You might want to bring it up on the mailing list if you feel it should be re-opened. Otherwise, nothing is likely to happen with it.

Show
Wendy Smoak added a comment - Rich, this issue is already closed as "Won't Fix" indicating that the developers don't consider it a valid bug. You might want to bring it up on the mailing list if you feel it should be re-opened. Otherwise, nothing is likely to happen with it.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: