<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.epseelon.samples.test</groupId>
        <artifactId>test</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>test-app</artifactId>
    <packaging>ear</packaging>
    <name>Test Project Application</name>
    <dependencies>
        <dependency>
            <groupId>${pom.groupId}</groupId>
            <artifactId>test-common</artifactId>
            <version>${pom.version}</version>
        </dependency>
        <dependency>
            <groupId>${pom.groupId}</groupId>
            <artifactId>test-core</artifactId>
            <version>${pom.version}</version>
            <type>ejb</type>
        </dependency>
        <dependency>
            <groupId>${pom.groupId}</groupId>
            <artifactId>test-web</artifactId>
            <version>${pom.version}</version>
            <type>war</type>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
        </dependency>
    </dependencies>
    <build>
        <finalName>${application.id}-${pom.version}</finalName>
        <resources>
            <resource>
                <directory>src/main/config</directory>
                <targetPath>../</targetPath>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/application</directory>
                <targetPath>../${application.id}-${pom.version}</targetPath>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <includes>**/*.xml</includes>
                    <excludes>**/jboss-app.xml</excludes>
                    <version>1.4</version>
                    <modules>
                        <jarModule>
                            <groupId>${pom.groupId}</groupId>
                            <artifactId>test-common</artifactId>
                            <includeInApplicationXml>true</includeInApplicationXml>
                        </jarModule>
                        <ejbModule>
                            <groupId>${pom.groupId}</groupId>
                            <artifactId>test-core</artifactId>
                        </ejbModule>
                        <webModule>
                            <groupId>${pom.groupId}</groupId>
                            <artifactId>test-web</artifactId>
                            <contextRoot>/${application.id}</contextRoot>
                        </webModule>
                    </modules>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.andromda.maven.plugins</groupId>
                <artifactId>andromdapp-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <deployLocation>${jboss.home}/server/default/deploy</deployLocation>
                    <!-- include the generated data source file -->
                    <includes>
                        <include>*ds.xml</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <!-- This profile here will allow you to specify -Ddeploy=link in order deploy an exploded ear using symbolic links,
             this allows you to easily edit things like jsp, xhtml, etc and just build the web module without having
             to deploy the ear -->
        <profile>
            <id>link</id>
            <activation>
                <property>
                    <name>deploy</name>
                    <value>link</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.andromda.maven.plugins</groupId>
                        <artifactId>andromdapp-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>link</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <deployLocation>${jboss.home}/server/default/deploy</deployLocation>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
