I used org.codehaus.mojo.archetypes:pom-root:1.1 to create a parent project 
(named `rbs'). Then I used org.codehaus.mojo.archetypes:ejb-jee5:1.3 to create 
2 ejb child projects (named `ejb-group1' and `ejb-group2'), used 
org.codehaus.mojo.archetypes:webapp-jee5:1.3 to create a web child project 
(named `dashboard') and finally used org.codehaus.mojo.archetypes:ear-jee5:1.4 
to create an ear project (named `ear-only1'). 

The generated parent pom.xml looks like this:
<project ...>
    <modelVersion>4.0.0</modelVersion>
    <groupId>home</groupId>
    <artifactId>rbs</artifactId>
    <version>0.1-snapshot</version>
    <modules>
        <module>dashboard</module>
        <module>ejb-group1</module>
        <module>ejb-group2</module>
        <module>ear-only1</module>
    </modules>
    <packaging>pom</packaging>
    <name>rbs</name>
</project>

The generated ejb project pom.xmls are (I post important lines only, the real 
pom.xml has dependencies on javaee-api, maven-ejb-plugin ...) :
<project ...>
    <parent>
        <artifactId>rbs</artifactId>
        <groupId>home</groupId>
        <version>0.1-snapshot</version>
    </parent>
    <artifactId>ejb-group1</artifactId>
    <packaging>ejb</packaging>
    <name>ejb-group1</name>
</project>

The generated web project pom.xml:
<project ...>
    <parent>
        <artifactId>rbs</artifactId>
        <groupId>home</groupId>
        <version>0.1-snapshot</version>
    </parent>
    <artifactId>dashboard</artifactId>
    <packaging>war</packaging>
    <name>dashboard</name>
</project>

The generated ear project pom.xml:
<project ...>
    <parent>
        <artifactId>rbs</artifactId>
        <groupId>home</groupId>
        <version>0.1-snapshot</version>
    </parent>
    <artifactId>ear-only1</artifactId>
    <packaging>ear</packaging>
    <name>ear-only1</name>
    <dependencies>
        <dependency>
            <groupId>home</groupId>
            <artifactId>dashboard</artifactId>
            <version>0.1-snapshot</version>
        </dependency>
        <dependency>
            <groupId>home</groupId>
            <artifactId>ejb-group1</artifactId>
            <version>0.1-snapshot</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <version>5</version>
                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                    <modules>
                        <webModule>
                            <groupId>home</groupId>
                            <artifactId>dashboard</artifactId>
                            <contextRoot>dashboard</contextRoot>
                        </webModule>
                        <ejbModule>
                            <groupId>home</groupId>
                            <artifactId>ejb-group1</artifactId>
                        </ejbModule>
                    </modules>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

I have a few questions:

1. If I want to use slf4j in all modules, should I declare it in the 
<dependencyManagement> of the parent pom.xml and in each module pom.xml I 
declare it in <dependency> without its version? Then when the .ear file is 
generated (mvn ear:ear doesn't work in my case yet), where are all the slf4j 
.jars stored? In `lib' directory because of 
<defaultLibBundleDir>lib</defaultLibBundleDir> or somewhere else?

2. When I run mvn ear:generate-application-xml in the parent project, maven 
said it could not resolve dependencies for project 
home:ear-only1:ear:0.1-snapshot. How can I tell maven to do whatever needed 
with the web and ejb modules first and use the result to generate the 
application.xml file?

Regards.

Reply via email to