Getting JRebel to work with 'mvn tomcat:run'
Asked Answered
C

3

13

I was wondering if someone could point me in the direction of getting JRebel to work when I execute 'mvn tomcat:run' from the command line. I can get JRebel to work in my IDE (IntelliJ IDEA), but it feels a little clunky to be running inside of the IDE. When I run tests, I don't like having another process running right next to it - call it a habit.

More than that though, I've been having some server lock ups with JRebel as I try it out... and I don't want IDE to hang as a result. I've been teminating the process manually, and control is given back to IDEA... but it would be better to not have it running in IDEA at all.

I've tried googling this, but I haven't found how to incorporate JRebel with the tomcat plugin.

Thanks

Canicula answered 26/4, 2011 at 9:28 Comment(0)
F
16

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.

Fulfill answered 26/4, 2011 at 11:29 Comment(2)
I didn't know about MAVEN_OPTS. I was looking in the actual pom.xml. Thanks!Canicula
yeah for me just adding the plugin to the pom worked great. thanks!Maxa
C
2

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.

Cistercian answered 26/10, 2011 at 13:27 Comment(0)
M
0

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

Mantelet answered 17/6, 2014 at 22:56 Comment(1)
Pushkar, there could be several reasons. Did the Javaagent run correctly? Did you have a valid license? Did you have a valid rebel.xml mappings for your application? Were the classes actually recompiled after the change was made? Turn to [email protected] for help.Recommit

© 2022 - 2024 — McMap. All rights reserved.