All,

I was after some feedback on how people structured their WEB (war) 
applications when using WSAD/Eclipse and maven for development.

My directory is structured as follows:
/WebProject
    /src
        /java
        /test
            /java
    /WebContent
        /WEB-INF
            /classes
            /lib
    /target (maven generated)

As with jar projects, I defined all dependencies in the pom and these are 
reflected in the .classpath file
A simple example:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src/java"/>
    <classpathentry kind="src" path="src/test/java"/>
    <classpathentry kind="var"
        path="SERVERJDK_50_PLUGINDIR/jre/lib/rt.jar" 
sourcepath="SERVERJDK_50_PLUGINDIR/src.jar"/>
    <classpathentry kind="var" path="MAVEN_REPO/j2ee/jars/j2ee-1.3.jar"/>
    <classpathentry kind="var" 
path="MAVEN_REPO/junit/jars/junit-3.8.1.jar"/>
    <classpathentry kind="var" 
path="MAVEN_REPO/log4j/jars/log4j-1.2.8.jar"/>
    <classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
</classpath>

This compiles fine. The classes are written to my 
WebContent/WEB-INF/classes directory.
BUT - If I run this application using a WebSphere Test Environment (WTE) 
server, it will fail because it can't find the log4j classes. 
The WTE uses the WebContent directory as an exploded war. WTE expects 
utility jars to be available to the WAS classloader, usually from the 
WEB-INF/lib directory. If I put the jars in the lib directory, I'm 
effectively maintaining the dependencies twice (in the pom and in 
WEB-INF/lib).

Of course, when building using maven, the exploded war is created in 
/target, including dependency jars added to /WEB-INF/lib. That all works 
fine, especially on a continuous integration server. 
If I could get WSAD to use the /target/webapp directory in the WTE, that 
would solve the problem, but I can't.
Therefore, using maven in a development environment seems to require 
deploy the generated ear for each test iteration. This loses much of the 
power of the WTE.

So what do other people do? I've extended war:war to add dependencies 
defined in the pom to the WebContent/WEB-INF/lib directory. But this 
requires maven war:war to be run before using WTE for the first time. That 
doesn't feel right.

The whole thing doesn't seem to fit well for war projects (great for 
jars). I'm still experimenting but I thought I'd ask for help!!!

I hope this makes sense :-)

Al.

Digital Union UK
[EMAIL PROTECTED]
www.digitalunion.com

t: +44 (0) 1483 889482  m:+44 (0) 7713 631367  f: +44 (0) 1483 889450

The information in this email and in any attachment(s) is confidential. If 
you are not the named addressee(s) or if you receive this email in error 
then any distribution, copying or use of this communication or the 
information in it is strictly prohibited.
While attachments are virus checked, Digital Union UK Limited does not 
accept any liability in respect of any virus which is not detected.

<div style="width:450px; border-top: 1px solid black; border-bottom: 1px solid black; 
font-family: Arial; font-size: 8pt">
<p>This email and any files transmitted with it are confidential and intended solely 
for the use of the individual or entity to whom they are addressed.&nbsp; If you have 
received this email in error please notify your system administrator. <br/><br/>While 
attachments are virus checked, Digital Union UK Limited does not accept any liability 
in respect of any virus which is not detected.</p>
</div>

Reply via email to