How to pack webapp as a deployable war?

I am new to Maven, but I am connected to what it offers. How can I take webapp and have the Maven webapp package as a deployable WAR? Also, can I configure Maven for the automatic build version?

+5
source share
2 answers

Here is an example from the getting started guide :

<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-webapp</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>my-webapp</finalName>
  </build>
</project>
+3
source

Go to the project directory and enter:

mvn clean package

target / my-webapp.war built

+1
source

All Articles