1

Just using the command line, what is the fastest way to fire up the embedded glassfish server make a change to a file, recompile, then redeploy the code?

I'm using:

  • mvn embedded-glassfish:run
  • change a line of code in vim
  • recompile
  • repackage project using: mvn -pl mymodule/myproject package -DskipTests
  • redeploy the server by pressing enter

That takes upwards of a minute plus to recompile and rebuild the war file. Can the embedded glassfish server be used on an exploded war dir? Is there a faster way to develop a servlet app?

Joe Kennedy
  • 9,365
  • 7
  • 41
  • 55
James
  • 15,085
  • 25
  • 83
  • 120

3 Answers3

2

You're doing it wrong. You shouldn't recompile and repackage the full app if you're using JRebel. It's only the changed class that you need to recompile and JRebel should pick up the change then.

Anton Arhipov
  • 6,479
  • 1
  • 35
  • 43
1

JRebel was supposed to do hot code loading of individual class files, why are you not just compiling the changed class and letting JRebel do its magic for you?

JRebel is a small JVM-plugin that makes it possible for Java developers to instantly see any code change made to an app without redeploying.

1

I haven't used embedded Glassfish, so I don't know if what I do is better, but here is what I do when developing a war.

  1. mvn package -P jr - creates target/project-1.0-SNAPSHOT which is the contents of the war. The -P jr is a profile configured to use JRebel.
  2. asadmin deploydir target/project-1.0-SNAPSHOT
  3. Now you can just do mvn compile and JRebel will load the newly compiled class.
Travis Stevens
  • 2,198
  • 2
  • 17
  • 25