quality@glassfish.java.net

Re: EJB development with Maven, making it easier and more fool proof.

From: Richard Kolb <rjdkolb_at_gmail.com>
Date: Tue, 16 Mar 2010 10:13:56 +0200

Hi Wouter

On 16 March 2010 10:01, Wouter van Reeven <wouter_at_van.reeven.nl> wrote:

>
> Another question: what scope did you give the log4j dependency?
>

the default scope.

If you do this same thing in a Maven WAR, the lib is bundled in WAR file

you can try it out.
1) on the command line build your EJB with a mvn package. Note the file size
2) Change the packaging to 'war' in the pom.xml
3) create a web.xml in /src/main/webapp/WEB-INF
e.g.
*<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" >
</web-app>*

4) do a 'mvn clean package'
5) Note the file size of the WAR (log4j is included)

Obviously the WAR packaging has a 'WEB-INF/lib/' where all the JAR's can be
dumped and Maven takes advantage of this.

I don't think EJB packaging has such a facility. (Not 100% sure of this)


regards
Richard.