Multiple module maven project questions

2009-03-15 Thread Thai Dang Vu
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:

4.0.0
home
seam-glassfish
1.0-SNAPSHOT
pom
seam-glassfish

ejb
war
ear



This is my ejb/pom.xml:

4.0.0
seam-glassfish-ejb
ejb
seam-glassfish-ejb

home
seam-glassfish
1.0-SNAPSHOT



This is my war/pom.xml:

4.0.0
seam-glassfish-war
war
seam-glassfish-war

home
seam-glassfish
1.0-SNAPSHOT



home
seam-glassfish-ejb
1.0-SNAPSHOT


This is my ear/pom.xml:

4.0.0
seam-glassfish-ear
ear
seam-glassfish-ear


home
seam-glassfish
1.0-SNAPSHOT




home
seam-glassfish-ejb
1.0-SNAPSHOT
ejb


home
seam-glassfish-war
1.0-SNAPSHOT
war



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:

jboss-seam-2.1.1.GA.jar

The jboss seam jar file can be found with a . 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

2009-03-16 Thread Martin Höller
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 ejb 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:
> 
> jboss-seam-2.1.1.GA.jar
> 
> The jboss seam jar file can be found with a . 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/


signature.asc
Description: PGP signature


Re: Multiple module maven project questions

2009-03-16 Thread Stephane Nicoll
See responses inline.

On Sun, Mar 15, 2009 at 12:24 PM, Thai Dang Vu  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:
>
> jboss-seam-2.1.1.GA.jar
>
> The jboss seam jar file can be found with a . 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 ejb 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