我使用带有tomcat-maven插件的tomcat7。我可以让它热插拔我的jsp,但只有当我直接在目标中修改它时,它才能起作用。我怎样才能让tomcat也在我的源目录中寻找变化?
pom.xml
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<serverXml>${project.build.directory}/config/tomcat-config/${usingDb}/server.xml</serverXml>
<tomcatUsers>${project.build.directory}/config/tomcat-config/tomcat-users.xml</tomcatUsers>
<configurationDir>${project.build.directory}/config/tomcat-config</configurationDir>
<additionalClassesDirs>
<classesDir>${project.basedir}/src/main/webapp</classesDir>
</additionalClassesDirs>
<contextReloadable>true</contextReloadable>
<port>${tomcat.http.local.port}</port>
<path>/${url.contextPath}</path>
</configuration>
</plugin>发布于 2017-08-11 05:27:22
这取决于您如何使用/启动maven插件。从以下内容开始
mvn tomcat7:run应该做到这一点(与run-war或任何其他目标相比)。有关详情,请访问http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/plugin-info.html。
这实际上会在您的tomcat中重新加载上下文。我不确定在没有重新加载上下文的情况下,真正的“热替换”是否可能没有第三方库/插件或类似的jrebel。
发布于 2017-08-11 05:38:28
您应该能够运行war: copied目标,将更改从您的源目录复制到目标目录。
发布于 2017-08-11 17:46:21
将Eclipse中的工作区更改为\tomcat\webapps,因为它只用于您的工作,这应该可以正常工作。无论您在Eclipse中做了什么更改,tomcat都会在同一个目录中查找要部署的应用程序
https://stackoverflow.com/questions/44637303
复制相似问题