0

My setup is

  • IDE: IntelliJ
  • Application: JEE6 with an EAR and a WAR module
  • Build: Maven
  • Hot-Code-Replacement: JRebel
  • App-Server: Glassfish 3.1

I configured the application in IntelliJ in a way that the ear gets deployed. The ear "target" folder looks like this target/classes/ target/appEar/appWeb-version-Snapshot.war/ target/appEar/lib/ target/appEar/META-INF

In the default configuration JRebel listens for changes in the classes/ folder. When I change something in the web module, and build this, the classes are only updated in appWeb/target/classes/ but not in appEar/target/appEar/appWeb-version-Snapshot.war/.

If I want to update those classes I have to select "Build Artifacts" in IntelliJ after building the project.

To sum up, I have to do these steps for a hot code replacement:

  1. (once) Configure JRebel correctly.
  2. Make project
  3. Build Artifacts

This whole procedure appears to be too complicated to me. Does anyone have a clue how to setup IntelliJ/Maven/Glassfish/JEE/JRebel correctly? I have not found an example containing all my tools. I'd like to have only one action for the code replacement, not two.

Soccertrash
  • 1,830
  • 3
  • 28
  • 48

2 Answers2

1

There's "build on make" checkbox in your project artifact settings, that will always recreate your artifact on compiling, if that's what you are looking for. However JRebel should remap where your application is reading class files and resources based on rebel.xml, so you probably should just rewrite rebel.xml to look for classes where they are compiled to, not where they end up after building the artifact.

Joonas Vali
  • 727
  • 6
  • 11
0

Why do you need to Build Artifacts every time?

Your war should contain the rebel.xml that maps to the classes in /target/classes folder.

When you make changes to said classes, your server then knows to load the changes from those classes.

So you only need to build your project in order to see the changes assuming your rebel.xml classpath points to /target/classes.

abbath
  • 2,444
  • 4
  • 28
  • 40
  • I need to build artifacts to make IntelliJ copy the content of the exploded war to the ear/target/. From there the application server picks up the classes. – Soccertrash Sep 13 '16 at 09:14
  • If you changes are not reloading after building the project then there is probably something wrong with the rebel.xml configuration. Could you write to support@zeroturnaround.com and attach jrebel log to your mail. How to send logs: https://manuals.zeroturnaround.com/jrebel/misc/sendinglogs.html – Risto Pärnapuu Sep 13 '16 at 09:46
  • JRebel is working fine. But I first have to build the project and afterwards "build artifacts". So I assume there is a more elegant project setup that can be done in IntelliJ for a JEE application. Moreover it should still work with maven. – Soccertrash Sep 13 '16 at 10:37