If you’re a web-developer, one of the best features of Eclipse is the JBoss IDE plugin. The mere fact that you don’t have to re-compile/re-deploy the war for every change saves countless hours per build.
If you don’t want to use Eclipse, you can replicate this behavior with Maven and run the app out of your working directory.
The first step is to navigate to the location of your code (hereon referred to as
$CODE_DIR) and execute the maven task:
$ mvn war:inplaceThis will create the entire
$CODE_DIR/src/main/webapp. Take a look. You’ll see a
WEB-INF. This is probably a good time to exclude these directories from version control. I use Git, so I added the following lines to
.gitignoreat the top level of the project:
src/main/resources/webapp/WEB-INF/classes src/main/resources/webapp/WEB-INF/libNow that you have a complete
waryou can have it deployed in jboss by creating a symlink. Assuming that
$JBOSS_HOMEis set, you need the following command:
mvn compile war:inplaceon its own won’t redeploy the classes. For that, you’ll need to touch the
web.xmlfile. You can do this with the maven exec plugin. This part is Linux/Mac OSX only. If you’re on Windows, well you have bigger problems beyond hot-deploy. Open up
$CODE_DIR/pom.xmland add the following lines:
org.codehaus.mojo exec-maven-plugin 1.1 exec touch src/main/webapp/WEB-INF/web.xml
mvn compile war:inplace exec:execwill redeploy the project right from your working directory. I have this configuration mapped to a keystroke in Intellij to make the process seamless. The benefits of this approach is that it will work with any IDE or development environment. It also works with JBoss 4.2 and 5.0 (JBoss tools has had some issues with 5.0 because of the VFS changes). It also works every time. JBoss tools would occasionally not update static files. The downside is that it’s not as seamless nor as fast. It will redeploy the webapp, just as if you had pushed a new war. The time savings are still substantial and I would give this approach a try if you use an environment other than eclipse for your java development.
Did you like this? Please share:
The Lost Year: A Failed Experiment to Switch Away From Mac
Fed up with the Apple Keyboard, I bought a ThinkPad, installed Linux, and promptly decided that I hated computers.
Maker's Space, Manager's Space
The Grand Remote Work Experiment: A Retrospective
The COVID-19 pandemic has lead to an unexpected experiment in remote working. What has worked and why?