Getting JRebel to work with 'mvn tomcat:run'

纵饮孤独 提交于 2019-11-30 05:02:11

doesn't setting MAVEN_OPTS system variable help?

Just and example:

  1. mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
  2. cd my-webapp
  3. to pom.xml of your example add the following:
    <plugin>
      <groupId>org.zeroturnaround</groupId>
      <artifactId>jrebel-maven-plugin</artifactId>
      <executions>
       <execution>
        <id>generate-rebel-xml</id>
        <phase>process-resources</phase>
         <goals>
          <goal>generate</goal>
         </goals>
       </execution>
      </executions>
    </plugin>
  4. set MAVEN_OPTS=-javaagent:/path/to/jrebel.jar
  5. mvn tomcat:run

In the console you'll see message from JRebel like these:

JRebel: Directory 'C:\projects\my-webapp\target\classes' will be monitored for changes.
JRebel: Directory 'C:\projects\my-webapp\src\main\webapp' will be monitored for changes.

If you happen to execute tomcat:run within eclipse and have the JRebel eclipse plugin installed, you can also simply enable JRebel on the run configuration.

When I tried it today. I didn't see my changes being reflected at run time. I had to relauch application to see changes take it effect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!