简体   繁体   English

让JRebel与'mvn tomcat:run'一起使用

[英]Getting JRebel to work with 'mvn tomcat:run'

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. 我在想,当我从命令行执行“ mvn tomcat:run”时,是否有人可以指出我的方向来使JRebel工作。 I can get JRebel to work in my IDE (IntelliJ IDEA), but it feels a little clunky to be running inside of the IDE. 我可以让JRebel在我的IDE(IntelliJ IDEA)中工作,但是在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. 除此之外,我还在尝试使用JRebel进行服务器锁定……而且我不希望IDE挂起。 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. 我一直在手动终止该过程,并将控制权交还给IDEA ...,但最好不要让它在IDEA中完全运行。

I've tried googling this, but I haven't found how to incorporate JRebel with the tomcat plugin. 我尝试使用谷歌搜索,但是还没有找到如何将JRebel与tomcat插件结合在一起。

Thanks 谢谢

doesn't setting MAVEN_OPTS system variable help? 没有设置MAVEN_OPTS系统变量帮助吗?

Just and example: 公正和示例:

  1. mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp mvn原型:generate -DgroupId = com.mycompany.app -DartifactId = my-webapp -DarchetypeArtifactId = maven-archetype-webapp
  2. cd my-webapp cd my-webapp
  3. to pom.xml of your example add the following: 在示例的pom.xml中添加以下内容:
    <plugin> <插件>
    <groupId>org.zeroturnaround</groupId> <groupId> org.zeroturnaround </ groupId>
    <artifactId>jrebel-maven-plugin</artifactId> <artifactId> jrebel-maven-plugin </ artifactId>
    <executions> <执行>
    <execution> <执行>
    <id>generate-rebel-xml</id> <id> generate-rebel-xml </ id>
    <phase>process-resources</phase> <phase>流程资源</ phase>
    <goals> <目标>
    <goal>generate</goal> <goal>生成</ goal>
    </goals> </ goals>
    </execution> </ execution>
    </executions> </ executions>
    </plugin> </ plugin>
  4. set MAVEN_OPTS=-javaagent:/path/to/jrebel.jar 设置MAVEN_OPTS = -javaagent:/path/to/jrebel.jar
  5. mvn tomcat:run mvn tomcat:运行

In the console you'll see message from JRebel like these: 在控制台中,您将看到来自JRebel的消息,如下所示:

JRebel: Directory 'C:\\projects\\my-webapp\\target\\classes' will be monitored for changes. JRebel:将监视目录'C:\\ projects \\ my-webapp \\ target \\ classes'的更改。
JRebel: Directory 'C:\\projects\\my-webapp\\src\\main\\webapp' will be monitored for changes. JRebel:将监视目录'C:\\ projects \\ my-webapp \\ src \\ main \\ webapp'的更改。

如果您恰巧在eclipse中执行tomcat:run并安装了JRebel eclipse插件,则还可以在运行配置中简单地启用JRebel。

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 我不得不重新启动应用程序才能看到更改生效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM