IDEA13 + Maven 3.1 + Tomcat6/7 + jrebel 4.5 热部署web应用


1、pom.xml中tomcat的配置

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <executions>
        <execution>
            <id>tomcat-run</id>
            <goals>
                <goal>exec-war-only</goal>
            </goals>
            <phase>package</phase>
            <configuration>
                <warRunDependencies>
                    <warRunDependency>
                        <dependency>
                            <groupId>cmsi</groupId>
                            <artifactId>cmsi</artifactId>
                            <version>1.0-SNAPSHOT</version>
                            <type>war</type>
                        </dependency>
                        <contextPath>/</contextPath>
                    </warRunDependency>
                </warRunDependencies>
                <enableNaming>true</enableNaming>
            </configuration>
        </execution>
    </executions>
</plugin>


2、在run/debug配置中添加本地Tomcat

wKioL1MRSJiwy3f5AAU7lrBl5c8858.jpg


注意:配置Tomcat实际上就是配置tomcat的vm参数,这个参数需要指定jrebel的jar在哪儿。

-noverify
-javaagent:D:\jrebel-4.5-cr\jrebel.jar
-Xmx512M
-Xms256M
-XX:MaxPermSize=1024m
-Drebel.spring_plugin=true
-Drebel.struts2_plugin=true


其他的配置含义是内存分配配置,以及对spring和struts2的支持配置!


3、如何使用

   配置好了后,启动或调试tomcat,当类文件修改后,编译一下,这样classes就会被热部署到tomcat,避免重启。

   如果上图中的4、5步骤没按照要求选择,则jrebel不起作用。


4、启动tomcat时候可以查看到jrebel是否生效,以及是否破解了,

wKiom1MRSqGgfgPTAAaEOYWPE-A974.jpg


你可能感兴趣的:(maven,jrebel)