As far as doing my complete EAR build with a single
Maven command I was unable to get either of the
proposed solutions to work.  In any event I really
appreciate all of the help with this, it has been an
informative exercise.

Below is a summary of my current solution, which uses
a simple shell script to do the overall EAR
build/install.  I hope this will be a helpful
contribution.  If anyone sees something which is
obviously wrong (which might bite me later) then
please point it out.  It seems to work well for now.


--James

------------------------------------------------------

The project has the following directory layout:

C:/dev/myproj-app
C:/dev/myproj-core
C:/dev/myproj-ejb
C:/dev/myproj-web


C:/dev/myproj-app Details:
-------------------------
The directory C:/dev/myproj-app has no source code and
is used primarily as a substitute for a true root
directory under which the other modules would reside
if this Maven-preferred directory layout was possible
(I am using Eclipse which doesn't allow this sort of
hierarchical project directory layout).

In the myproj-app/maven directory is a project.xml
which has the overall project's <currentVersion>,
Project Management entries (<organization>,
<mailingLists>, etc.), and <build> entry.  These are
omitted from the other modules' project.xml files and
"inherited" by virtue of having an <extend> entry
which references this main project.xml.  There are no
dependencies in this maven/project.xml file.

The dependencies section of the myproj-app project's
project.xml includes dependencies for the modules
which make up the EAR:


    <dependencies>

        <dependency>
            <groupId>myproj</groupId>
            <artifactId>myproj-core</artifactId>
            <version>${pom.currentVersion}</version>
            <type>jar</type>
            <properties>
                <ear.bundle>true</ear.bundle>
            </properties>
        </dependency>

        <dependency>
        <groupId>myproj</groupId>
            <artifactId>myproj-ejb</artifactId>
            <version>${pom.currentVersion}</version>
            <type>ejb</type>
            <properties>
                <ear.bundle>true</ear.bundle>
            </properties>
        </dependency>

        <dependency>
            <groupId>myproj</groupId>
            <artifactId>myproj-web</artifactId>
            <version>${pom.currentVersion}</version>
            <type>war</type>
            <properties>
<ear.appxml.war.context-root>/</ear.appxml.war.context-root>
                <ear.bundle>true</ear.bundle>
            </properties>
        </dependency>

    </dependencies>


In the myproj-app project's project.properties file is
the following property which is necessary for Maven to
generate the EAR's application.xml:

maven.ear.appxml.generate = true


I have created a script which does the entire EAR
build process, listed below:


#!/bin/sh

#-------------------------------------
# build and install the core JAR

cd ../myproj-core
maven jar:install


#-------------------------------------
# build and install the EJB JAR

cd ../myproj-ejb
maven ejb:install


#-------------------------------------
# build and install the WAR

cd ../myproj-web
maven war:install


#-------------------------------------
# build and install the EAR

cd ../myproj-app
maven ear:install





C:/dev/myproj-core Details:
--------------------------
This project contains the core classes used by all
other modules (JavaBeans, util and exception classes,
etc.).  The project.xml contains only dependencies for
the libraries needed for the build.  The JAR is built
and installed to the local repository by running
"maven jar:install".



C:/dev/myproj-ejb Details:
-------------------------
This project contains the EJB classes.  The
project.xml contains dependencies for the libraries
needed for the build, as well as for the myproj-core
module.  The JAR is built and installed to the local
repository by running "maven ejb:install".

The dependency needed for the core module:

        <dependency>
            <groupId>myproj</groupId>
            <artifactId>myproj-core</artifactId>
            <version>${pom.currentVersion}</version>
            <type>jar</type>
            <properties>
                <ear.bundle>true</ear.bundle>
            </properties>
        </dependency>



C:/dev/myproj-web Details:
-------------------------
This project contains the Servlet and associated
utility classes used by the web module.  The
project.xml contains dependencies for the libraries
needed for the build, a dependency for the EJB module,
and a dependency for the myproj-core module.  The WAR
is built and installed to the local repository by
running "maven war:install".

The dependencies needed for the core module:

        <dependency>
            <groupId>myproj</groupId>
            <artifactId>myproj-core</artifactId>
            <version>${pom.currentVersion}</version>
            <type>jar</type>
            <properties>
                <ear.bundle>true</ear.bundle>
            </properties>
        </dependency>

        <dependency>
            <groupId>myproj</groupId>
            <artifactId>myproj-ejb</artifactId>
            <version>${pom.currentVersion}</version>
            <type>ejb</type>
            <properties>
                <ear.bundle>true</ear.bundle>
            </properties>
        </dependency>


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250

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

Reply via email to