You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jonathan Taub <Jo...@TheSoftForge.com> on 2008/05/13 05:35:41 UTC

J2EE projects with Maven 2

*Sorry* to be posting this again but the previous posting's content was HTML (sorry) and subject got whacky.

I’m sure the topic of building a J2EE project with Maven has been discussed before but I’ve failed to find useful leads.
I’m not a Maven guru though I’ve worked with it before mainly by packaging various jars into a war file.
I’m starting a new project from scratch and would really like to follow build best practices.
However, when it comes to J2EE project, good documentation is nowhere to be found.

I played with the j2ee-simple archetype (http://maven.apache.org/plugins/maven-archetype-plugin/examples/j2ee-simple.html): 

mvn archetype:create -DgroupId=com.mobilexl -DartifactId=com.mobilexl.server -DarchetypeArtifactId=maven-archetype-j2ee-simple

However, it creates some directories which I can’t really make sense of, in the top level directory:
* primary-source
* src
* projects

What is primary-source exactly? Is it build related like the ear directory?
What is the src doing under the root directory? Aren’t source files located under the webapp, projects, and ejb directory?
I assume projects contains multiple modules (regular jars), but can’t be sure about that.
I’m playing around with this layout for the time being but I don’t really like it.
Maybe because I’m used to other layouts and I haven’t yet seen the light.
However, as time passes, I’m more inclined of using the following "custom" layout:

\
-- ejb1-3
-- ejb4-6
-- ejb7-n
-- webapp
-- module1
-- module2
-- module3


I’ll start from the end, actually:
* Modules are just “ordinary” pure Java projects packaged as a .jar file (each one)
* webapp is a regular web application package as a .war file.
* ejb are pure Java projects + EJBs (bean class, remote/local interfaces, etc.) packaged into .jar file.

The build will build each module and all of the artifacts (war, jar) will be packaged inside an .ear file somewhere.
This is the way I used to do it with Ant.


My questions are:
* Does this seem reasonable to you?
* What problems might I ran into.
* I will be deploying to JBoss and I don’t believe I’ll need any container specific goals/tasks.
* I’m using EJB 3.0 (though without JPA) it that makes any difference. If so, how?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org