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


    jetty插件的配置

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

    [html] view plain copy
     
    1. <plugins>  
    2.            <plugin>  
    3.                <groupId>org.eclipse.jetty</groupId>  
    4.                <artifactId>jetty-maven-plugin</artifactId>  
    5.                <version>9.3.0.M2</version>  
    6.                <configuration>  
    7.                    <webAppConfig>  
    8.                        <contextPath>/</contextPath>  
    9.                    </webAppConfig>  
    10.                    <httpConnector>  
    11.                        <port>8081</port>  
    12.                        <idleTimeout>10000</idleTimeout>  
    13.                    </httpConnector>  
    14.                </configuration>  
    15.            </plugin>  
    16.            <plugin>  
    17.             <groupId>org.apache.maven.plugins</groupId>  
    18.             <artifactId>maven-war-plugin</artifactId>  
    19.             <version>2.4</version>  
    20.             <configuration>  
    21.                 <webResources>  
    22.                     <resource>  
    23.                         <directory>src/main/webapp/WEB-INF</directory>  
    24.                     </resource>  
    25.                 </webResources>  
    26.             </configuration>  
    27.         </plugin>  
    28.        </plugins>  
    29.    </build>  
    30.   
    31.    <profiles>  
    32.        <profile>  
    33.            <id>dev</id>  
    34.            <properties>  
    35.                <ejs.url.resources>http://127.0.0.1:8080</ejs.url.resources>  
    36.                <ejs.static.resources>http://127.0.0.1:8080</ejs.static.resources>  
    37.                <ejs.image.resources>http://127.0.0.1:8070/ejsimage</ejs.image.resources>  
    38.                <ejs.cookie.domain>.ejavashop.com</ejs.cookie.domain>  
    39.                <ejs.cookie.name>ejavashop_b2b2c_admin</ejs.cookie.name>  
    40.                <ejs.front.url>http://120.0.0.1:8807</ejs.front.url>  
    41.                <ejs.h5.url>http://120.0.0.1:8808</ejs.h5.url>  
    42.   
    43.                <shop.write.url>jdbc:mysql://127.0.0.1:3306/ejavashop</shop.write.url>  
    44.                <shop.write.username>root</shop.write.username>  
    45.                <shop.write.password>root</shop.write.password>  
    46.                  
    47.                <shop.read.url>jdbc:mysql://127.0.0.1:3306/ejavashop</shop.read.url>  
    48.                <shop.read.username>root</shop.read.username>  
    49.                <shop.read.password>root</shop.read.password>  
    50.                  
    51.                <analysis.write.url>jdbc:mysql://127.0.0.1:3306/ejavashop_analysis</analysis.write.url>  
    52.                <analysis.write.username>root</analysis.write.username>  
    53.                <analysis.write.password>root</analysis.write.password>  
    54.                  
    55.                <analysis.read.url>jdbc:mysql://127.0.0.1:3306/ejavashop_analysis</analysis.read.url>  
    56.                <analysis.read.username>root</analysis.read.username>  
    57.                <analysis.read.password>root</analysis.read.password>  
    58.                  
    59.                <search.solr.url>http://127.0.0.1:8070/solr</search.solr.url>  
    60.                <search.solr.server>ejavashopcore</search.solr.server>  
    61.   
    62.                <pom.log.file>F:/Users/logs/ejavashop-admin.log</pom.log.file>  
    63.                <pom.log.level>info</pom.log.level>  
    64.            </properties>  
    65.        </profile>  
    66.          
    67.    </profiles>  

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

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

    然后我们在

    这样我们就可以

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

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

    jrebel配置

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

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

    效果等同

    最后设置完成的效果:

    对于rebel.xml中的内容:

    [html] view plain copy
     
    1. <?xml version="1.0" encoding="UTF-8"?>  
    2.   
    3. <!--  
    4.   This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.  
    5.   Refer to https://manuals.zeroturnaround.com/jrebel/standalone/config.html for more information.  
    6. -->  
    7. <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">  
    8.   
    9.     <classpath>  
    10.         <dir name="F:/ejavashop/ejavashop/ejavashop-admin/target/classes">  
    11.         </dir>  
    12.     </classpath>  
    13.   
    14.     <web>  
    15.         <link target="/">  
    16.             <dir name="F:/ejavashop/ejavashop/ejavashop-admin/src/main/webapp/WEB-INF">  
    17.             </dir>  
    18.         </link>  
    19.         <link target="/">  
    20.             <dir name="F:/ejavashop/ejavashop/ejavashop-admin/src/main/webapp">  
    21.             </dir>  
    22.         </link>  
    23.     </web>  
    24.   
    25. </application>  


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

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

    执行编译快捷键是:

    ctrl+shift+F9编译单个类

    ctrl+F9 编译整个项目

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

  • 相关阅读:
    107. Binary Tree Level Order Traversal II
    103. Binary Tree Zigzag Level Order Traversal
    102. Binary Tree Level Order Traversal
    690. Employee Importance
    1723. Find Minimum Time to Finish All Jobs
    LeetCode 329 矩阵中最长增长路径
    7.2 物理内存管理
    LeetCode 面试题 特定深度节点链表
    LeetCode 100 相同的树
    npm安装包命令详解,dependencies与devDependencies实际区别
  • 原文地址:https://www.cnblogs.com/a8457013/p/7866492.html
Copyright © 2020-2023  润新知