13

我想知道当我从命令行执行 'mvn tomcat:run' 时,是否有人可以指出让 JRebel 工作的方向。我可以让 JRebel 在我的 IDE (IntelliJ IDEA) 中工作,但在 IDE 中运行感觉有点笨拙。当我运行测试时,我不喜欢在它旁边运行另一个进程——称之为习惯。

不仅如此,当我尝试使用 JRebel 时,我一直在使用 JRebel 锁定一些服务器……而且我不希望 IDE 因此挂起。我一直在手动终止该过程,并将控制权交还给 IDEA ......但最好不要让它在 IDEA 中运行。

我试过用谷歌搜索这个,但我还没有找到如何将 JRebel 与 tomcat 插件结合起来。

谢谢

4

3 回答 3

16

设置 MAVEN_OPTS 系统变量没有帮助吗?

只是和例子:

  1. mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
  2. cd my-webapp
  3. 在示例的 pom.xml 中添加以下内容:
    <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. 设置 MAVEN_OPTS=-javaagent:/path/to/jrebel.jar
  5. mvn tomcat:运行

在控制台中,您将看到来自 JRebel 的消息,如下所示:

JRebel:将监视目录 'C:\projects\my-webapp\target\classes' 的更改。
JRebel:将监视目录 'C:\projects\my-webapp\src\main\webapp' 的更改。

于 2011-04-26T11:29:13.390 回答
2

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

于 2011-10-26T13:27:52.877 回答
0

今天试的时候。我没有看到我的更改在运行时得到反映。我必须重新启动应用程序才能看到更改生效

于 2014-06-17T22:56:47.063 回答