The best place to ask programming/development questions, imo. UPDATE: stackoverflow is the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but a great reference for finding answers.

My Music (Nickleus)


How to configure JRebel for a war module

Here's how I configured JRebel for our company's member application war module:

build.xml code:
<war destfile="${dest.ear.dir}/memberapp.war" webxml="${root}/memberapp/WEB-INF/web.xml">
    <classes dir="${root}/memberapp/WEB-INF" includes="rebel.xml"/>
    <classes dir="${dest.dir}/java" includes="com/tc/memberapp/**"/>
    <webinf dir="${root}/memberapp/WEB-INF" excludes="classes/,web.xml,rebel.xml"/>
    <fileset dir="${root}/memberapp" excludes="com/,WEB-INF/"/>

${root} == /home/me/eclipseWorkspace/trunk
${dest.dir} == /home/me/eclipseWorkspace/trunk/tmp/src (a temporary folder used during the build)
${dest.ear.dir} == /home/me/eclipseWorkspace/trunk/tmp/dist/company-ear (a temporary folder used during the build)

rebel.xml location in our source:

as you can see from the build.xml code, during the ant build, rebel.xml gets moved to WEB-INF/classes, so the final location in the company-app.ear looks like this:

rebel.xml contents:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="" xmlns="" xsi:schemaLocation="">
        <dir name="/home/me/eclipseWorkspace/trunk/bin/com/tc/memberapp"/>
        <link target="/">
            <dir name="/home/me/eclipseWorkspace/trunk/memberapp" />

what is important to notice here is that the link target is root, i.e. / and NOT /MemberApp/ (the actual web deployment location in a browser) because according to the jrebel documentation:
"This will ... map the web resources in the [dir name] directory to the root ("/") of the web application context"

Note: Each war module needs its own rebel.xml.

No comments:

Post a Comment