Maven3を使用してプロジェクトをビルドしています。カスタムルートを定義したいWebアプリケーションがあります。Tomcat 6のドキュメントによると、次のように書かれています。
The locations for Context Descriptors are:
1. $CATALINA_BASE/conf/[enginename]/[hostname]/context.xml
2. $CATALINA_BASE/webapps/[webappname]/META-INF/context.xml
Files in (1) are named [webappname].xml but files in (2) are named context.xml.
If a Context Descriptor is not provided for a Context, Tomcat configures the Context using default values.
定義したカスタムルートを使用したい。カスタムcontext.xmlファイルを定義すると、Tomcatにパスが表示されないため、これをどのように実現できますか。上記によると、コンテキスト記述子がコンテキストに提供されていない場合、Tomcatはデフォルト値を使用してコンテキストを構成します。以下のcontext.xmlに示すように、コンテキスト記述子をすでに定義しています。
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/data1"/>
deploy.warをTomcatにデプロイすると、/data1にアクセスできなくなります。ただし、/dataは機能します。warファイルがデプロイされると、context.xmlが配置されたMETA-INFが含まれます。
私のPOMファイル:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.data</groupId>
<artifactId>Java-WebApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Java-Web Application</name>
<!-- Shared version number properties-->
<properties>
<org.springframework.version>3.0.6.RELEASE</org.springframework.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0</version>
<configuration>
<webResources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
<finalName>data</finalName>
</build>
<parent>
<groupId>com.data</groupId>
<artifactId>Java-Parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
</project>
次のWebサイトを調べましたが、役に立たないようです。