intelliJ IDEA热部署配置
2019-03-07 本文已影响0人
温暖的纯真
1. File->Setting勾选build project automatically

2. Run/Debug Configurations的Tomcat Server配置 选择On 'Update' action为Update classes and resources

3. 修改Registry的compiler.automake.allow.when.app.running
快捷键 Ctrl + Shift + a


-
Deployment选择 war exploded
image.png
- war:发布模式,先打包再发布
- war exploded模式:把项目的文件夹移动到tomcat的部署文件夹,进行加载部署。
-
Spring Boot使用spring-boot-devtools热部署
//pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope><!-- 需要设置为true->
</dependency>
...
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--<executable>true</executable>-->
<fork>true</fork> <!--没有该配置,devtools 不生效-->
</configuration>
</plugin>
</plugins>
//application.properties
#热部署生效
spring.devtools.restart.enabled = true
#设置重启的目录,默认全部
#spring.devtools.restart.additional-paths = src/main/java
#classpath目录下的static文件夹内容修改不重启
spring.devtools.restart.exclude = src/main/resources/static