Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would a maven-war-plugin generate a JAR instead of a WAR?

I am following this Contract first using CXF tutorial and while the resulting pom.xml generates sources and even completes build successfully, it fails to create a WAR file.

Instead, it creates a JAR file.

My understanding is that the part in the pom.xml that's responsible for creating the WAR is:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <version>2.1.1</version>
  <configuration>
    <outputDirectory>D:/path/to/profile/autodeploy</outputDirectory>
  </configuration>
 </plugin>

I don't see any <goal> or <execution> element there (unlike in the build-helper-maven-plugin one), but I also understand that with this plugin this is implied as even the official usage page demonstrates:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <webappDirectory>/sample/servlet/container/deploy/directory</webappDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...
</project>

So... what am I missing?

What could possibly explain a maven-war-plugin that behaves in unexpected way like this and produces a JAR instead of a WAR by default?

Is there a way to force it to produce a WAR?

like image 433
Eternal Learner Avatar asked Aug 01 '13 23:08

Eternal Learner


1 Answers

packaging should be as below.

<packaging>war</packaging>

if it won't help then try binding your plug-in configuration with a lifecycle phase.

like image 174
Jaffar Ramay Avatar answered Sep 28 '22 08:09

Jaffar Ramay