博客
关于我
SpringBoot项目修改html后不即时编译
阅读量:755 次
发布时间:2019-03-22

本文共 898 字,大约阅读时间需要 2 分钟。

在Spring Boot项目中,修改html模板后无法实现即时编译的效果。经过搜索资料和实践总结,以下是解决问题的有效方法和经验分享。

1. pom中引入依赖

首先,需要在项目的POM文件中添加Spring Boot开发工具的依赖。在dependencies配置部分增加如下内容:

org.springframework.boot
spring-boot-devtools
true

2. IDE设置

在IntelliJ IDEA中进行以下设置:

  • 自动编译设置

    打开 file - settings - Build, Execution, Deployment - Compiler,勾选 Build project automatically 选项。

  • 组合键设置

    按住 Shift + Ctrl + Alt + /,选择 Registry选项,勾选 compiler.automake.allow.when.app.remain 选项。

  • 3. 项目刷新

    在修改模板文件后,右键点击项目根目录,选择 Reload All,或者在 IDE中关闭并重新打开项目,确保最新的模板生效。

    4. 模板解释

    模板修改后,偶尔可能会导致模板缓存问题。在 src/main/resources 文件夹中,检查是否有 template.html 或其他模板文件被 erroneously拷贝或修改。

    5. 遗留问题处理

    修改模板后,因模板缓存问题导致无法立即看到修改效果?可以尝试以下方法:

  • 通过清除IDE缓存:

    在 file - settings - Build, Execution, Deployment - Compiler 中,清除缓存器中的内容。

  • 重新初始化模板路径:

    src/main/resources/templates 文件夹中,确保模板文件名正确无误,没有被ุคคล友好的文件覆盖。

  • 通过以上方法,可以快速解决Spring Boot项目模板修改后无法举行即时编译问题,提升开发效率。

    转载地址:http://ozawk.baihongyu.com/

    你可能感兴趣的文章
    npm如何清空缓存并重新打包?
    查看>>
    npm学习(十一)之package-lock.json
    查看>>
    npm安装 出现 npm ERR! code ETIMEDOUT npm ERR! syscall connect npm ERR! errno ETIMEDOUT npm ERR! 解决方法
    查看>>
    npm安装crypto-js 如何安装crypto-js, python爬虫安装加解密插件 找不到模块crypto-js python报错解决丢失crypto-js模块
    查看>>
    npm安装教程
    查看>>
    npm报错Cannot find module ‘webpack‘ Require stack
    查看>>
    npm报错Failed at the node-sass@4.14.1 postinstall script
    查看>>
    npm报错fatal: Could not read from remote repository
    查看>>
    npm报错File to import not found or unreadable: @/assets/styles/global.scss.
    查看>>
    npm报错TypeError: this.getOptions is not a function
    查看>>
    npm报错unable to access ‘https://github.com/sohee-lee7/Squire.git/‘
    查看>>
    npm淘宝镜像过期npm ERR! request to https://registry.npm.taobao.org/vuex failed, reason: certificate has ex
    查看>>
    npm版本过高问题
    查看>>
    npm的“--force“和“--legacy-peer-deps“参数
    查看>>
    npm的安装和更新---npm工作笔记002
    查看>>
    npm的常用操作---npm工作笔记003
    查看>>
    npm的常用配置项---npm工作笔记004
    查看>>
    npm的问题:config global `--global`, `--local` are deprecated. Use `--location=global` instead 的解决办法
    查看>>
    npm编译报错You may need an additional loader to handle the result of these loaders
    查看>>
    npm设置淘宝镜像、升级等
    查看>>