Tomcat7 Tomcat 7 Maven插件多上下文
在我当前的pom.xml状态下Tomcat7 Tomcat 7 Maven插件多上下文,tomcat7,maven-tomcat-plugin,Tomcat7,Maven Tomcat Plugin,在我当前的pom.xml状态下 <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.0</version> <configuration> <path>/myPath</pat
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<path>/myPath</path>
</configuration>
</plugin>
org.apache.tomcat.maven
tomcat7 maven插件
2
/我的路径
这很好用。我现在尝试为服务器上的图像添加一个额外的上下文,
因此,“旧”上下文/myPath
指向webapp,并且/images
可用于处理图像。我已尝试添加上下文文件,但执行此操作时,仅加载我的
/images
上下文。另外,我不想每次都构建WAR(如果我在两个上下文中使用两个context.xml文件,就会出现这种情况) 是否可以添加a)上下文(使用tomcat7的当前开发状态:run和b)仅指向本地文件夹的第二个上下文/图像? 怎么做呢?虽然是,但我认为最好发布xml的外观:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<path>/myPath</path>
<staticContextPath>/images</staticContextPath>
</configuration>
</plugin>
另一项说明: ,插件使用,
staticContextPath
作为contextPath
传递,staticContextDocbase
作为baseDir
传递。baseDir
的文档声明它必须存在,相对于主服务器
OTOH,baseDir
按原样移动。baseDir
方法上的文档说明可以是绝对路径名、相对路径名或URL。
那么试试完整的路径。如果不起作用,就去找亲戚;) 那么,我如何将本地文件夹链接到静态路径呢?@MatthiasG你称之为
本地文件夹
?我想让我的上下文(/myPath)指向正在开发的webapp,而localhost:8080/images指向即C:\data\images@MatthiasG因此,请尝试使用staticContextDocbase(记录为静态上下文的完全限定路径)。这是tomcat7 maven插件中的一个错误,已在2.3-SNAPSHOT中修复。尝试使用2.3-SNAPSHOT,它应该可以工作。
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<path>/myPath</path>
<staticContextPath>/images</staticContextPath>
<staticContextDocbase>C:/images</staticContextDocbase>
</configuration>
</plugin>