Unfortunately you have encountered Maven's achilles heel (It's
fantastic at nearly everything else). Managing ejb/ear dependencies is
still basically a manual process.
In general, what I do is:
introduce a "pom" project that lists all the dependencies that you
expect to be placed in the ear, aside from ejb-jars and war files.
Maintaining this is a manual process.
have the ear project, war projects and ejb projects all depend upon
this pom project
have the war and ejb projects depend upon other ejb projects as required
configure war and ejb plugins to generate manifest classpaths (unless
building JEE5 ears, and using it's lib directory facility)
There's some discussion on this topic at <http://docs.codehaus.org/display/MAVENUSER/Solving+the+Skinny+Wars+problem
>, with references to various JIRA entries regarding this. I
discovered the technique above somewhere in there.
Following these steps is still way easier than maintaining ant build
scripts, so we are still ahead there. But it's a tricky problem that
may need coupling between the various ear/ejb/war plugins in order to
be solved satisfactorily.
Cheers,
Steve C
On 27/08/2009, at 6:25 AM, David Sharp wrote:
I'm new to Maven, and I am struggling to figure out how to get it to
do
packaging in accordance with the standards at my work place.
Suppose I have
an ejb called project-ejb, that depends on a library called
caf-3.1.0.jar.
How do I setup my project to package this dependency at the ear
level rather
than putting it into the ejb? There may be other ejbs and webapps
in the
ear that also depend on this jar.
Should I specify it as a dependency of the ear with a scope of
compile, and
then also specify it as a dependency of the ejb with a scope of
provided?
Or is there a way to simply specify it at the ear level, and have
the ejb
inherit it? I've tried to make the ejb a child project of the ear
but then
Maven complains that I've introduced a cyclic dependency.
I've searched for examples, but all of the ones I have seen don't
address
the issue of packaging dependencies for an EJB at the ear level.
I would greatly appreciate any help.
Thanks,
Dave