there's a simpler way...

in each subproject include a project.properties file with (at least) a line like

maven.multiproject.type=ejb

(or war, rar, jar, ear, plugin etc depending what it is)

then on the top level project

maven multiproject:install

will build and install all the subprojects.

I don't use eclipse but I thought that the eclipse plugin handled multiproject structures. Try maven eclipse:multiproject and see what happens.

david jencks

On Feb 16, 2005, at 3:54 PM, James Adams wrote:

Thanks Arnaud, this looks like a perfect solution.

Unfortunately I have two problems which I'm not sure
how to handle:

1. When I try the proposed solution I get an exception
complaining about the j element not being bound.  For
example:

Fatal Error [line 4, row 40]: The prefix "j" for
element "j:set" is not bound.
org.apache.maven.MavenException: Error parsing plugin
script

Am I perhaps missing a Maven component which is not
part of the default distribution ?


2. Because I am using Eclipse I cannot have all of my projects in subdirectories under a main project directory. Hence I have the myproj-app project which I'm using to build the EAR (there is no code in that project, it's just there for Maven build purposes). It's this project's directory that I'm using as a faux root directory. Essentially my directory layout looks like this:

C:\dev\myproj-app
C:\dev\myproj-ejb
C:\dev\myproj-util
C:\dev\myproj-web

For testing the proposed solution I have created a
maven.xml and project.properties in C:\dev.  However I
would like to have the myproj-app directory be the
place where the original maven command is called.  I
am planning to do something like the below in the
maven.xml and project.properties under
C:\dev\myproj-app:

--- maven.xml ---
<project default="myproj:default">
  <goal name="myproj:default" prereqs="ear:install">
    <j:set var="goal" value="myproj:default"/>
    <attainGoal name="multiproject:goal"/>
  </goal>
</project>

--- project.properties ---
# Multiproject properties
maven.multiproject.includes=../myproj-ejb/project.xml,../myproj-util/ project.xml,../myproj-web/project.xml
maven.multiproject.excludes=project.xml



Does this look reasonable ? (I can't test it myself until I resolve issue #1 above, as it gives the same exceptions.)

Thanks...


--James




--- Arnaud HERITIER <[EMAIL PROTECTED]> wrote:

You're right, you can't do it by default.
But to do it, it's "very" simple.

In each subproject you create a maven.xml file with
:

- in myproj-util :
<project default="myproj:default">
  <goal name="myproj:default"
prereqs="jar:install"/>
</project>

- in myproj-ejb :
<project default="myproj:default">
  <goal name="myproj:default"
prereqs="ejb:install"/>
</project>

- in myproj-web :
<project default="myproj:default">
  <goal name="myproj:default"
prereqs="war:install"/>
</project>

- in myproj-app :
<project default="myproj:default">
  <goal name="myproj:default"
prereqs="ear:install"/>
</project>


And in your project's root : A maven.xml file : <project default="myproj:default"> <goal name="myproj:default"> <j:set var="goal" value="myproj:default"/> <attainGoal name="multiproject:goal"/> </goal> </project>

A project.properties file :

# Multiproject properties
maven.multiproject.includes=**/project.xml
maven.multiproject.excludes=project.xml


You type in your root directory : maven :-)

Arnaud


-----Message d'origine-----
De : James Adams [mailto:[EMAIL PROTECTED]
Envoy� : mercredi 16 f�vrier 2005 22:27
� : Maven Users List
Objet : Re: How to build a EAR with EJB and WAR
included ?

Thanks for the help so far. After some initial
confusion
I've come up with a working solution. I have
broken my
project up into three separate projects
(myproj-util,
myproj-ejb, and myproj-web) and created an overall
project
for creating the EAR (myproj-app).
I found


http://www-106.ibm.com/developerworks/java/library/j-maven/index.html
to be a very helpful resource, with a good
explanation of how
I can extend the main POM in order to have the
same version
number across all of the modules.

I'd like to come up with a way to run one maven
command to do
the following:

1. create and install the
myproj-util-<version>.jar 2. create
and install the myproj-ejb-<version>.jar 3. create
and
install the myproj-web-<version>.war 4. create and
install
the myproj-app-<version>.ear

From what I can tell this is not possible with a
single maven
command and I will have to cook up a script which
will call
the jar:install, ejb:install, war:install, and
ear:install
maven goals from the proper directories. Is this
really the
case, or am I missing something ?


--James




__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to