How do I start Jetty with JRebel in Eclipse?

I am using jetty maven plugin in Eclipse to deploy my application. This is the pom.xml part:

        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.2.5.v20141112</version>
            <dependencies>
                <dependency>
                    <groupId>org.ow2.asm</groupId>
                    <artifactId>asm</artifactId>
                    <version>5.0.2</version>
                </dependency>
                <dependency>
                    <groupId>org.ow2.asm</groupId>
                    <artifactId>asm-commons</artifactId>
                    <version>5.0.2</version>
                </dependency>
            </dependencies>
            <configuration>
                <scanIntervalSeconds>2</scanIntervalSeconds>
                <stopKey>stop</stopKey>
                <stopPort>9999</stopPort>
            </configuration>
        </plugin>

      

I also installed the JRebel plugin in Eclipse. So how can I launch my jetty with JRebel?

+3


source to share


3 answers


I luckily found the answer on the Maven config page (where I call jetty: run) and it works. For those who need it and use the JRebel Eclipse plugin, here is the answer:

(I would still appreciate it if someone knows a better way. Maybe in the pom.xml, in the jetty.maven.plugin config?)



enter image description here

+3


source


You need to specify JRebel as JVM argument. Since Jetty runs in the same JVM process as Maven, once Maven figures out that you have Jetty installed, it's too late.

You have two options in this situation.



  • Pass the Maven argument and when Jetty starts in the same process it will connect to the JRebel agent. You can use an environment variable for this MAVEN_OPTS

    .
  • Use jetty:run-forked

    . It creates a separate JVM process for Jetty and allows you to specify arguments via a config option <jvmArgs/>

    .
+3


source


Install JRebel for eclipse using the eclipse Marketplace (Help> Eclipse Marketplace) and restart eclipse.

Once you've created the maven project and configured jetty, right click on the project and you should now see the JRebel option in the context menu. Click onJRebel > Add Jrebel Nature

Jrebel Eclipse plugin

Your project will then automatically generate a file rebel.xml

and should be configured to run with the changes you make to your project without restarting the server. Other than that, I haven't made any specific changes to the project. But JRebel works great.

You can also add the JRebel nature to the project by doing this,

Help > JRebel Configuration > Projects Tab > Other Projects > Demo_Project

      

Hope it helps.

0


source







All Articles