Hi,

I have a multi-project POM that works fine for compilation and work as
a whole but is very difficult to work with in IDEs and when it comes
to compiling sub components separately.

The POM structure looks like this:

Main POM
--> EJB Project POM
--> WAR Container POM
    --> WebApp WAR Project POM 1
    --> WebApp WAR Project POM 2
    --> WebApp WAR Project POM 3
--> EAR Container POM
    --> WebApp EAR Project POM 1
    --> WebApp EAR Project POM 2
    --> WebApp EAR Project POM 3
--> Quartz Project POM

In my main POM, I define my modules as such:

-------------
<modules>
                <module>ejbs</module> <!-- This is for EJB Project -->
                <module>webapps</module> <!-- this is for WebApp WARs -->
                <module>ear</module> <!-- this is for WebApp EARs -->
                <module>scheduler</module> <!-- this is for Quartz -->
</modules>
-------------

The "ejbs" module is simple: I have my project directly inside the
ejbs subfolder and there's no dependency on any of the other modules.
The POM looks like this:

-------------
        <groupId>myBigProject.project</groupId>
        <artifactId>ejbs</artifactId>
        <packaging>ejb</packaging>
        <version>1.0</version>
        <name>myBigProject EJBs sub-module</name>
-------------

In the "webapps" module, I have all my actual web application projects:

-------------
<project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>myBigProject.project</groupId>
        <artifactId>webapps</artifactId>
        <packaging>pom</packaging>
        <name>My Web Application Module Container</name>
        <version>1.0</version>
        <parent>
                <groupId>myBigProject</groupId>
                <artifactId>project</artifactId>
                <version>1.0</version>
        </parent>
        <modules>
                <module>myWebProject01</module>
                <module>myWebProject02</module>
                <module>myWebProject03</module>
        </modules>
        <dependencies>
        </dependencies>
</project>
-------------

Each one of the submodules here are individual WAR projects. Let's
take a look in "myWebProject01".

-------------
   <groupId>myBigProject.project.webapps</groupId>
   <artifactId>myWebProject01</artifactId>
   <packaging>war</packaging>
   <name>myWebProject01</name>
. <!-- some unnecessary stuff snipped -->
.
.
.
.
   <dependencies>
                <dependency>
                        <groupId>myBigProject.project</groupId>
                        <artifactId>ejbs</artifactId>
                        <version>1.0</version>
                        <classifier>client</classifier>
                </dependency>
.
.
.
   </dependencies>
-------------

As you can see, my WebApp WAR project has a dependency on the EJBs
submodule which is a couple of levels removed within the same master
project.

When I build using "mvn package", I have no problems getting the WAR
projects to locate the EJB JAR file. Maven would package the EJBs
module first and then when compiling the WebApp project, it would
source for the client EJB JAR from the directory directly without
searching for it in the repositories.

However, I'm unable to run "mvn clean compile" since if the EJB JAR
was not created, naturally Maven would not be able to source for it
when it's compiling the WebApps. Furthermore, when loading the project
in NetBeans or Eclipse (using either m2eclipse or Q4E), it's also
unable to get the relevant dependencies from the EJBs module since it
insists on locating the JAR file instead of treating it as a code
project dependency.

Is there a better way for me to organize my project here? I really
don't want to upload each iteration of the EJB JAR file to the repo as
nobody else uses it other that the associated WAR projects. And I sure
as heck wanna discourage my developers from doing a "mvn install" on
the EJB module 'cos that just gives me synchronization headaches all
the time.

Thanks,
Wong

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

Reply via email to