Tomcat删除webapps中符号链接引用的重要文件夹

时间:2017-03-21 18:43:22

标签: java maven tomcat symlink cargo

我有一个在tomcat上运行的maven应用程序,我使用货物启动它:

mvn cargo:run

在webapps文件夹中,有一个指向重要文件夹的符号链接:

ls /usr/local/Cellar/tomcat/8.0.15/libexec/webapps/ROOT/WEB-INF/views
admin   898 Jul 21  2016 notImplemented.jsp
admin  3355 Oct  3 15:13 genericError.jsp
admin    41 Mar 21 18:43 vhosts -> /Users/me/Project/important/folder   <<<<<< HERE

问题是,当我启动服务器时,tomcat会按照符号链接删除文件夹中包含的所有内容。

当我通过intellij启动tomcat时,没有问题。我从日志中注意到删除发生在第4行(尝试从/ ROOT删除WAR):

1 [INFO] [stalledLocalDeployer] Undeploying context [] from [/usr/local/Cellar/tomcat/8.0.15/libexec/webapps]...
2 [INFO] [stalledLocalDeployer] The WAR file has its context set to / and will therefore be deployed as ROOT.war
3 [INFO] [stalledLocalDeployer] Trying to delete WAR from     [/usr/local/Cellar/tomcat/8.0.15/libexec/webapps/ROOT.war]...
4 [INFO] [stalledLocalDeployer] Trying to delete WAR from [/usr/local/Cellar/tomcat/8.0.15/libexec/webapps/ROOT]...
5 [INFO] [stalledLocalDeployer] Deploying [/Users/.....war] to [/usr/local/Cellar/tomcat/8.0.15/libexec/webapps]...
6 [INFO] [stalledLocalDeployer] The WAR file has its context set to / and will therefore be deployed as ROOT.war

我在OSX 10.11.3上运行tomcat 8.0.15并使用cargo-maven2-plugin v1.6.1。

你可以建议一个解决方案来防止在tomcat启动时删除符号链接内容吗? 感谢

解决方案

最后,我将在启动tomcat之前删除tomcat工作目录中包含的所有符号链接。它解决了这个问题。

find ${TOMCAT_HOME}/webapps -type l -delete

0 个答案:

没有答案