【问题标题】:tomcat7-maven-plugin - jsp/html no deployedtomcat7-maven-plugin - jsp/html 未部署
【发布时间】:2013-12-03 12:45:44
【问题描述】:

使用 tomcat 插件“tomcat7-maven-plugin”,我试图让“热部署”与嵌入式 tomcat 一起工作(使用 tomcat7:run)。

我在 Eclipse 下使用典型的 Maven Web 应用配置。 从现在开始,我可以调试我的 java 类,它们会在代码更改时自动重新部署

但是我的 html 和 jsp 没有得到 *re*deployed (${basedir}/src/main/webapp)。

        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <update>true</update>
                <contextReloadable>true</contextReloadable>
            </configuration>
        </plugin>

(我使用的是原型“Thymeleaf Spring Maven Archetype”)。

知道如何在更改时重新部署 html 和 jsp 吗?

【问题讨论】:

    标签: jsp maven hotdeploy embedded-tomcat-7


    【解决方案1】:

    我相信问题可能出在 spring/thymeleaf 配置中。请确保在您的 spring 配置中禁用 thymeleaf 模板缓存。见:Spring MVC with Thymeleaf. Update static data(具体答案:https://stackoverflow.com/a/14659583/1581069

    一般来说,缓存应该只用于生产(当然,可能会有例外,但是......)。另一方面,开发人员有兴趣查看最新的模板更新。

    更新:再次阅读您的问题后,我感到困惑,正如您提到的百里香,但 jsp 也是如此。据我所知,thymeleaf 正在做 html(作为 jsp 的替代品)。那么你使用的是thymeleaf,还是jsp?因为我只选择了百里香。

    【讨论】:

    • 太棒了! Thymeleaf 默认启用缓存。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 2011-11-22
    • 2012-07-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-10
    • 1970-01-01
    • 2012-10-26
    • 1970-01-01
    相关资源
    最近更新 更多