gpt4 book ai didi

tomcat - 是否可以通过 Maven Cargo 插件提供 Tomcat6 的 context.xml 文件?

转载 作者:行者123 更新时间:2023-11-28 21:46:22 25 4
gpt4 key购买 nike

如果可能,我希望将 Tomcat 的 context.xml 文件保留在我的 WAR 文件的 META-INF 目录之外。这可以用 Maven 的 cargo 插件来完成吗?我似乎找不到正确的配置。

最佳答案

Eureka !经过多天的研究这个问题,我终于找到了一个非常有效的解决方案。关键是获取 Tomcat XML 上下文片段文件并使用 <configfiles> cargo 元素将其丢弃在 conf/Catalina/localhost名为 context.xml.default 的目录.唯一的缺点是,这将使您的上下文定义可用于所有网络应用程序,但这并不重要,只有 Cargo 使用此 Tomcat 实例,因此没有其他网络应用程序。

配置如下:

<configuration> <!-- Deployer configuration -->
<type>standalone</type>
<properties>
<cargo.servlet.port>${tomcat6.port}</cargo.servlet.port>
</properties>
<deployables>
<deployable>
<groupId>com.myapp<groupId>
<artifactId>myapp-war</artifactId>
<type>war</type>
<properties>
<context>${tomcat6.context}</context>
</properties>
</deployable>
</deployables>
<configfiles>
<configfile>
<file>${basedir}/../config/tomcat-context.xml</file>
<todir>conf/Catalina/localhost/</todir>
<tofile>context.xml.default</tofile>
</configfile>
</configfiles>
</configuration>

最终结果是不再有仅用于测试的虚假 WAR 模块,也不再合并 WAR。希望这对某人有所帮助。

关于tomcat - 是否可以通过 Maven Cargo 插件提供 Tomcat6 的 context.xml 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4305935/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com