在IntelliJ IDEA 2018.1.4中实现Springboot的自动部署

本文详细介绍如何在IntelliJ IDEA中实现SpringBoot项目的自动部署,包括HTML页面的不重启项目自动编译和JAVA代码的热部署。通过修改IDEA设置和项目配置,提升前端与后端协同开发效率。

前一段时间有写过一篇文章《IntelliJ IDEA开发环境配置》,里边写的有部分部署上的问题,但是不全面。

近来与前端协同做项目,,同用IntelliJ IDEA,看到前端在调试UI时总是在重启项目(设置前),于是就将部署方式重新写了一篇文章,以作笔记记录。


下面来说说springBoot项目的自动部署:

SpringBoot的部署分为两种,一个是HTML页面的不重启项目自动编译,,一个是JAVA代码的热部署。

  • HTML页面不重启项目自动编译:

1、修改IntelliJ IDEA的设置,开启自动编译

Ctrl+Alt+S -->打开Settings--> Build, Execution, Deployment -->Compiler

2、修改IntelliJ IDEA的行为

Ctrl+Shift+A-->输入registry

在上图所示的列表中找到上图选中的选项勾选上(不勾选的时候是在下边的没有在第一位)

至此,在页面里边更改js以及css或页面内容,项目就会自动编译了。

  • JAVA代码热部署

1、在SpringBoot项目的pom文件中添加相应的jar包

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

2、修改pom文件中的maven配置

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                </configuration>
            </plugin>

 

警告: 无法从[C:\Users\21523\.IntelliJIdea2018.2\system\tomcat\鏈懡鍚峗springboot-schema-master\conf\server.xml]加载服务器配置 java.io.FileNotFoundException: C:\Users\21523\.IntelliJIdea2018.2\system\tomcat\conf\server.xml (系统找不到指定的路径。) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.<init>(FileInputStream.java:138) at java.io.FileInputStream.<init>(FileInputStream.java:93) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188) at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getResource(CatalinaBaseConfigurationSource.java:121) at org.apache.tomcat.util.file.ConfigurationSource.getConfResource(ConfigurationSource.java:157) at org.apache.tomcat.util.file.ConfigurationSource.getServerXml(ConfigurationSource.java:131) at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getServerXml(CatalinaBaseConfigurationSource.java:54) at org.apache.catalina.startup.Catalina.parseServerXml(Catalina.java:569) at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:611) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:390) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:479) 十一月 03, 2025 10:05:01 上午 org.apache.catalina.startup.Catalina stopServer 严重: 停止 Catalina 时出错 ERROR: transport error 202: connect failed: Connection refused Disconnected from server ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
最新发布
11-04
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值