Friday, May 22, 2009

Exploded Hot deployment with Maven and Java Rebel outside IDE

Here is another way, more simpler than the one shown in my earlier post.

The following configuration works with JBoss. Adjust accordingly with your app server. Assuming you have all the required plugins as laid out in the earlier post.

Configuration Steps

  1. In the JBoss deploy folder, create any folder with folder name ending with .war (e.g. myProject.war)
  2. Setup your IDE environment with Maven plugin and run the project as usual.
  3. Make sure your project compiles and generates a .ear or .war file in the default Maven target folder structure. Extract the lib folder as it contains all the dependencies of your project.
  4. Inside the myProject.war, create a WEB-INF folder and paste that lib folder. This is the only manual step that requires due attention. Rest is just configuration and synchronization!
  5. Configure Java Rebel as laid out in the earlier post. However, put the Java Rebel settings in JBossDir/bin/run.bat file.
  6. Ensure the classpath of your Maven project in your IDE has all the Java paths and resources folders. Also ensure that the output directory for your project classpath is myProject->target->classes folder
  7. Using FileSync plugin, synchronize two folders (from within Eclipse)
    • MavenProject->web->src->main->webapp to deployDir->myproject.war folder
    • MavenProject->target->classes to deployDir->myproject.war->WEB-INF->classes
  8. That's it.
  9. Continue coding, run JBoss in background from the console using run.bat file in JBoss/bin directory. Save your file (.java, .js, .ftl, .vm, .xml) and check it immediately in your browser.

Smart Coding....