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

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启动我们项目的时候:



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值