Skip to content

Instantly share code, notes, and snippets.

@alexproca
Forked from dwelch2344/pom.xml
Created September 6, 2018 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexproca/5198069e856818ac395c21a6c80e3798 to your computer and use it in GitHub Desktop.
Save alexproca/5198069e856818ac395c21a6c80e3798 to your computer and use it in GitHub Desktop.
Executable WAR example via Tomcat Maven Plugin
<?xml version="1.0" encoding="UTF-8"?>
<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">
<!-- Your stuff here... -->
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>tomcat-run</id>
<goals>
<goal>exec-war-only</goal>
</goals>
<phase>package</phase>
<configuration>
<path>/</path>
<finalName>exec-${project.build.finalName}.jar</finalName>
<!-- optional only if you want to use a preconfigured server.xml file -->
<!-- <serverXml>src/main/conf/server.xml</serverXml> -->
<!-- War dependencies -->
<!--
<warRunDependencies>
<warRunDependency>
<dependency>
<groupId>a groupId</groupId>
<artifactId>and artifactId</artifactId>
<version>version</version>
<type>war</type>
</dependency>
<contextPath>/</contextPath>
</warRunDependency>
</warRunDependencies>
-->
<!-- naming is disabled by default so use true to enable it -->
<enableNaming>true</enableNaming>
<!-- extra dependencies to add jdbc driver, mail jars, etc. -->
<!-- <extraDependencies>
<extraDependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.1.3.1</version>
</extraDependency>
<extraDependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</extraDependency>
</extraDependencies> -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment