The best place to *find* answers to programming/development questions, imo, however it's 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 again, a great reference for *finding* answers.

My Music (Nickleus)

20130513

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/"/>
</war>



${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:
/home/me/eclipseWorkspace/trunk/memberapp/WEB-INF/rebel.xml


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:
<company-app.ear>/memberapp.war/WEB-INF/classes/rebel.xml


rebel.xml contents:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
    <classpath>
        <dir name="/home/me/eclipseWorkspace/trunk/bin/com/tc/memberapp"/>
    </classpath>
    <web>
        <link target="/">
            <dir name="/home/me/eclipseWorkspace/trunk/memberapp" />
        </link>
    </web>
</application>



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