You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Thai Dang Vu <dx...@yahoo.com> on 2009/03/15 12:24:08 UTC
Multiple module maven project questions
This is the directory structure of my project
seam-glassfish
|-- ear
| |-- pom.xml
|-- ejb
| |-- src
| |-- pom.xml
|-- war
| |-- src
| |-- pom.xml
|-- pom.xml
This is the parent pom.xml:
<modelVersion>4.0.0</modelVersion>
<groupId>home</groupId>
<artifactId>seam-glassfish</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>seam-glassfish</name>
<modules>
<module>ejb</module>
<module>war</module>
<module>ear</module>
</modules>
<!-- nothing special about other parts -->
This is my ejb/pom.xml:
<modelVersion>4.0.0</modelVersion>
<artifactId>seam-glassfish-ejb</artifactId>
<packaging>ejb</packaging>
<name>seam-glassfish-ejb</name>
<parent>
<groupId>home</groupId>
<artifactId>seam-glassfish</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<!-- nothing special about other parts -->
This is my war/pom.xml:
<modelVersion>4.0.0</modelVersion>
<artifactId>seam-glassfish-war</artifactId>
<packaging>war</packaging>
<name>seam-glassfish-war</name>
<parent>
<groupId>home</groupId>
<artifactId>seam-glassfish</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>home</groupId>
<artifactId>seam-glassfish-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
This is my ear/pom.xml:
<modelVersion>4.0.0</modelVersion>
<artifactId>seam-glassfish-ear</artifactId>
<packaging>ear</packaging>
<name>seam-glassfish-ear</name>
<parent>
<groupId>home</groupId>
<artifactId>seam-glassfish</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>home</groupId>
<artifactId>seam-glassfish-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>home</groupId>
<artifactId>seam-glassfish-war</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
I have some questions here:
1. How to tell the maven-ear-plugin to use my application.xml? And where in the ear directory should I place my own application.xml?
2. Because of the dependency on the ejb, I have to run mvn install in the ejb directory before I can run mvn compiler:compile in the war directory. Is there any way (like target dependencies in ant) to tell maven to compile / install all modules needed before the mvn compiler:compile is executed?
3. In my application.xml, beside the ejb and war modules, I need to add one more module like this:
<module><ejb>jboss-seam-2.1.1.GA.jar</ejb></module>
The jboss seam jar file can be found with a <dependency>. What should I do to tell maven to include that file into the root of the ear file it creates when I run mvn ear:ear in the ear directory?
4. If I don't want to create the seam-glassfish-ear-1.0-SNAPSHOT.ear file, but a seam-glassfish-ear-1.0-SNAPSHOT_ear directory in which the ejb module is unpacked in the seam-glassfish-ejb-1.0-SNAPSHOT_jar directory, the war module is unpacked in the seam-glassfish-war-1.0-SNAPSHOT_war directory and the jboss seam library above is unpacked in the jboss-seam-2.1.1.GA_jar directory, what should I do?
I read the http://maven.apache.org/plugins/maven-ear-plugin/ but found no shine to my questions (maybe there are, but not apparent to a maven newbie like me).
Thank you.
Re: Multiple module maven project questions
Posted by Martin Höller <ma...@xss.co.at>.
Hi!
On 15 Mar 2009, Thai Dang Vu wrote:
[...]
> I have some questions here:
>
> 1. How to tell the maven-ear-plugin to use my application.xml? And where in the ear directory should I place my own application.xml?
The m-ear-p is able to autogenerate an application.xml for you. Maybe you
should try to use this feature. See [1] for details.
If auto-generation doesn't fit your needs, I'd put my application.xml in
src/main/resources/META-INF/application.xml of my ear module. IMHO, this
should work.
> 2. Because of the dependency on the ejb, I have to run mvn install in the ejb directory before I can run mvn compiler:compile in the war directory.
Your dependencies are incorrect! You missed they <type>ejb</type> in your
war dependency declaration.
> 3. In my application.xml, beside the ejb and war modules, I need to add one more module like this:
>
> <module><ejb>jboss-seam-2.1.1.GA.jar</ejb></module>
>
> The jboss seam jar file can be found with a <dependency>. What should I do to tell maven to include that file into the root of the ear file it creates when I run mvn ear:ear in the ear directory?
Not 100% sure what you want to achieve. Did you try specifying the seam
artifact as a normal dependency (with scope runtime) of your EAR?
hth,
- martin
[1] http://maven.apache.org/plugins/maven-ear-plugin/
Re: Multiple module maven project questions
Posted by Stephane Nicoll <st...@gmail.com>.
See responses inline.
On Sun, Mar 15, 2009 at 12:24 PM, Thai Dang Vu <dx...@yahoo.com> wrote:
> This is the directory structure of my project
>
>
[...]
>
> I have some questions here:
>
> 1. How to tell the maven-ear-plugin to use my application.xml? And where in
> the ear directory should I place my own application.xml?
The default directory for ear sources is src/main/application. If you put
your application.xml file in src/main/application/META-INF/application.xml,
Maven will pick it up automatically. Most users let maven generates it for
you. The ear plugin does that by default.
>
>
> 2. Because of the dependency on the ejb, I have to run mvn install in the
> ejb directory before I can run mvn compiler:compile in the war directory. Is
> there any way (like target dependencies in ant) to tell maven to compile /
> install all modules needed before the mvn compiler:compile is executed?
Well, you invoke mvn package at the root level and it will do that for you.
>
>
> 3. In my application.xml, beside the ejb and war modules, I need to add one
> more module like this:
>
> <module><ejb>jboss-seam-2.1.1.GA.jar</ejb></module>
>
> The jboss seam jar file can be found with a <dependency>. What should I do
> to tell maven to include that file into the root of the ear file it creates
> when I run mvn ear:ear in the ear directory?
Make it a dependency :) If you need something, it needs to be a dependency.
You miss the <type>ejb</type> in the jboss-seam dep.
>
>
> 4. If I don't want to create the seam-glassfish-ear-1.0-SNAPSHOT.ear file,
> but a seam-glassfish-ear-1.0-SNAPSHOT_ear directory in which the ejb module
> is unpacked in the seam-glassfish-ejb-1.0-SNAPSHOT_jar directory, the war
> module is unpacked in the seam-glassfish-war-1.0-SNAPSHOT_war directory and
> the jboss seam library above is unpacked in the jboss-seam-2.1.1.GA_jar
> directory, what should I do?
Read the doc a bit more. To explode the modules, there's an option for that
http://maven.apache.org/plugins/maven-ear-plugin/examples/unpacking-a-module.html
For the EAR itself there's a feature request (
http://jira.codehaus.org/browse/MEAR-51) but you can have a direct solution
with the dependency plugin (unpack goal)
>
>
> I read the http://maven.apache.org/plugins/maven-ear-plugin/ but found no
> shine to my questions (maybe there are, but not apparent to a maven newbie
> like me).
Question 1,2,3 are not maven ear plugin's question but Maven questions. You
better have to read more tutorial on Maven itself first
HTH,
S.
>
> Thank you.
>
>
>
>
--
Large Systems Suck: This rule is 100% transitive. If you build one, you
suck" -- S.Yegge