IDEA热部署(二)---jetty插件启动maven项目

来源:互联网 发布:医疗数据集成平台厂家 编辑:程序博客网 时间:2024/05/18 03:32

jetty插件的配置

我们使用jetty插件来进行启动我们的maven项目,在pom.xml中进行配置:

 <plugins>            <plugin>                <groupId>org.eclipse.jetty</groupId>                <artifactId>jetty-maven-plugin</artifactId>                <version>9.3.0.M2</version>                <configuration>                    <webAppConfig>                        <contextPath>/</contextPath>                    </webAppConfig>                    <httpConnector>                        <port>8081</port>                        <idleTimeout>10000</idleTimeout>                    </httpConnector>                </configuration>            </plugin>            <plugin>            <groupId>org.apache.maven.plugins</groupId>            <artifactId>maven-war-plugin</artifactId>            <version>2.4</version>            <configuration>                <webResources>                    <resource>                        <directory>src/main/webapp/WEB-INF</directory>                    </resource>                </webResources>            </configuration>        </plugin>        </plugins>    </build>    <profiles>        <profile>            <id>dev</id>            <properties>                <ejs.url.resources>http://127.0.0.1:8080</ejs.url.resources>                <ejs.static.resources>http://127.0.0.1:8080</ejs.static.resources>                <ejs.image.resources>http://127.0.0.1:8070/ejsimage</ejs.image.resources>                <ejs.cookie.domain>.ejavashop.com</ejs.cookie.domain>                <ejs.cookie.name>ejavashop_b2b2c_admin</ejs.cookie.name>                <ejs.front.url>http://120.0.0.1:8807</ejs.front.url>                <ejs.h5.url>http://120.0.0.1:8808</ejs.h5.url>                <shop.write.url>jdbc:mysql://127.0.0.1:3306/ejavashop</shop.write.url>                <shop.write.username>root</shop.write.username>                <shop.write.password>root</shop.write.password>                                <shop.read.url>jdbc:mysql://127.0.0.1:3306/ejavashop</shop.read.url>                <shop.read.username>root</shop.read.username>                <shop.read.password>root</shop.read.password>                                <analysis.write.url>jdbc:mysql://127.0.0.1:3306/ejavashop_analysis</analysis.write.url>                <analysis.write.username>root</analysis.write.username>                <analysis.write.password>root</analysis.write.password>                                <analysis.read.url>jdbc:mysql://127.0.0.1:3306/ejavashop_analysis</analysis.read.url>                <analysis.read.username>root</analysis.read.username>                <analysis.read.password>root</analysis.read.password>                                <search.solr.url>http://127.0.0.1:8070/solr</search.solr.url>                <search.solr.server>ejavashopcore</search.solr.server>                <pom.log.file>F:/Users/logs/ejavashop-admin.log</pom.log.file>                <pom.log.level>info</pom.log.level>            </properties>        </profile>            </profiles>

plugin:下载我们使用的jetty插件。

profile:目的是不同环境使用不同的配置信息, 有点相当于我们的properties文件

然后我们在



这样我们就可以


使用这几个按钮进行启动了。

最后两个绿色按钮大家可能没有,那个是jrebel的按钮。

jrebel配置

我们在idea中安装了jrebel,我们那个项目可以使用jrebel来进行启动,从这里设置:


可以使用jrebel的项目,我们还可以从这里设置:


效果等同

最后设置完成的效果:

对于rebel.xml中的内容:

<?xml version="1.0" encoding="UTF-8"?><!--  This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.  Refer to https://manuals.zeroturnaround.com/jrebel/standalone/config.html for more information.--><application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_1.xsd"><classpath><dir name="F:/ejavashop/ejavashop/ejavashop-admin/target/classes"></dir></classpath><web><link target="/"><dir name="F:/ejavashop/ejavashop/ejavashop-admin/src/main/webapp/WEB-INF"></dir></link><link target="/"><dir name="F:/ejavashop/ejavashop/ejavashop-admin/src/main/webapp"></dir></link></web></application>

jrebel监控的是F:/ejavashop/ejavashop/ejavashop-admin/target/classes下的文件哦,所以只要改动的类编译过后就可以监控到了。

使用jetty插件的时候,项目运行起来并不能够立即看到效果,需要我们进行手动编译,

执行编译快捷键是:

ctrl+shift+F9编译单个类

ctrl+F9 编译整个项目


如果我们对于某个Java进行了编译,热部署,我们看到的效果是,我们需要在使用jrebel启动我们项目的时候: