Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Jetty Configuration multiple war contexts and with web.xml override to avoid windows file locking
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sample</groupId>
<artifactId>testwebserver</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mygroup</groupId>
<artifactId>org.sample.myservices.web</artifactId>
<version>${project.version}</version>
<classifier>classes</classifier>
</dependency>
<dependency>
<groupId>org.sample</groupId>
<artifactId>org.sample.auth.web</artifactId>
<version>${project.version}</version>
<classifier>classes</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<!--
<dependencies>
<dependency>
<groupId>org.sample</groupId>
<artifactId>testwebserver</artifactId>
<version>${project.version}</version>
<classifier>classes</classifier>
</dependency>
</dependencies>
-->
<configuration>
<skip>false</skip>
<httpConnector>
<port>10996</port>
</httpConnector>
<!--<webApp implementation="org.sample.jetty.JettyWebAppContextEx"> -->
<webApp implementation="org.eclipse.jetty.maven.plugin.JettyWebAppContext">
<contextPath>/</contextPath>
<resourceBase>${project.basedir}/src/main/webapp</resourceBase>
<overrideDescriptor>${project.basedir}/src/main/resources/override-web.xml</overrideDescriptor>
</webApp>
<contextHandlers>
<!--<contextHandler implementation="org.sample.jetty.JettyWebAppContextEx">-->
<contextHandler implementation="org.eclipse.jetty.maven.plugin.JettyWebAppContext">
<contextPath>/cms</contextPath>
<resourceBase>${project.basedir}/../cms/cms-ui/web</resourceBase>
<overrideDescriptor>${project.basedir}/src/main/resources/override-web.xml</overrideDescriptor>
</contextHandler>
<contextHandler implementation="org.eclipse.jetty.maven.plugin.JettyWebAppContext">
<resourceBase>${project.basedir}/../auth/auth-ui/web</resourceBase>
<contextPath>/auth</contextPath>
<overrideDescriptor>${project.basedir}/src/main/resources/override-web.xml</overrideDescriptor>
</contextHandler>
<contextHandler implementation="org.eclipse.jetty.maven.plugin.JettyWebAppContext">
<resourceBase>${project.basedir}/../svcmgmt-ui/web</resourceBase>
<contextPath>/myservices</contextPath>
<overrideDescriptor>${project.basedir}/src/main/resources/override-web.xml</overrideDescriptor>
</contextHandler>
<contextHandler implementation="org.eclipse.jetty.maven.plugin.JettyWebAppContext">
<war>${project.basedir}/../auth/auth-api/target/org.sample.auth.web-0.0.1-SNAPSHOT</war>
<contextPath>/auth-api</contextPath>
<overrideDescriptor>${project.basedir}/src/main/resources/override-web.xml</overrideDescriptor>
</contextHandler>
<contextHandler implementation="org.eclipse.jetty.maven.plugin.JettyWebAppContext">
<war>${project.basedir}/../svcmgmt-api/web/target/org.sample.myservices.web-0.0.1-SNAPSHOT</war>
<contextPath>/myservices-api</contextPath>
<overrideDescriptor>${project.basedir}/src/main/resources/override-web.xml</overrideDescriptor>
</contextHandler>
</contextHandlers>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
metadata-complete="false"
version="3.1">
<context-param>
<param-name>web.environment</param-name>
<param-value>ci</param-value>
</context-param>
<servlet>
<servlet-name>default</servlet-name>
<init-param>
<param-name>useFileMappedBuffer</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>maxCachedFiles</param-name>
<param-value>0</param-value>
</init-param>
</servlet>
</web-app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment