<?xml version="1.0" encoding="UTF-8"?>
<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>
        <artifactId>mail</artifactId>
        <groupId>org.jboss.seam.examples-ee6</groupId>
        <version>2.3.0.Beta1</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    
    <groupId>org.jboss.seam.examples-ee6.mail</groupId>
    <artifactId>mail-ear</artifactId>
    <packaging>ear</packaging>
    <name>Mail EAR Module (EE6)</name>
    
    <properties>
        <jboss.home>${env.JBOSS_HOME}</jboss.home>
        <jboss.domain>default</jboss.domain>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>org.jboss.seam.examples-ee6.mail</groupId>
            <artifactId>mail-web</artifactId>
            <type>war</type>
        </dependency>
        <dependency>
            <groupId>org.jboss.seam.examples-ee6.mail</groupId>
            <artifactId>mail-ejb</artifactId>
            <type>ejb</type>
        </dependency>
        <dependency>
            <groupId>org.jboss.seam</groupId>
            <artifactId>jboss-seam</artifactId>
            <type>ejb</type>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.thoughtworks.xstream</groupId>
                    <artifactId>xstream</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xpp3</groupId>
                    <artifactId>xpp3_min</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>jfree</groupId>
            <artifactId>jfreechart</artifactId>
        </dependency>
        <dependency>
        	<groupId>org.hibernate</groupId>
        	<artifactId>hibernate-validator</artifactId>
        </dependency>
    </dependencies>

    <build>
        <finalName>seam-mail</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <configuration>
                    <version>5</version>
                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                    <!-- Exclude eclipse generated application.xml and manually modified jboss-app.xml during mvn build  -->
                    <earSourceExcludes>**/application.xml, **/jboss-app.xml</earSourceExcludes>
                    <!-- use maven generated application.xml instead -->
                    <generateApplicationXml>true</generateApplicationXml>
                    <filtering>true</filtering>
<!--                    <jboss>
                        <version>4.2</version>
                        <loader-repository>seam.jboss.org:loader=seam-mail</loader-repository>
                    </jboss>-->
                    <modules>
                        <ejbModule>
                            <groupId>org.jboss.seam</groupId>
                            <artifactId>jboss-seam</artifactId>
                            <bundleFileName>jboss-seam.jar</bundleFileName>
                        </ejbModule>
                        <webModule>
                            <groupId>org.jboss.seam.examples-ee6.mail</groupId>
                            <artifactId>mail-web</artifactId>
                            <contextRoot>/seam-mail</contextRoot>
                            <bundleFileName>mail-web.war</bundleFileName>
                        </webModule>
                        <ejbModule>
                            <groupId>org.jboss.seam.examples-ee6.mail</groupId>
                            <artifactId>mail-ejb</artifactId>
                            <bundleFileName>mail-ejb.jar</bundleFileName>
                        </ejbModule>
                    </modules>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                       <id>copy-greenmail-service</id>
                       <phase>package</phase>
                       <goals>
                          <goal>copy</goal>
                       </goals>
                       <configuration>
                          <artifactItems>
                              <artifactItem>
                                   <groupId>com.icegreen</groupId>
                                   <artifactId>greenmail-jboss-service</artifactId>
                                   <version>1.3.1b</version>
                                   <type>sar</type>
                                   <overWrite>false</overWrite>
                                   <outputDirectory>${project.build.directory}</outputDirectory>
                                    <destFileName>greenmail-jboss-service.sar</destFileName>
                              </artifactItem>
                          </artifactItems>
                       </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>exploded</id>
            <properties>
                <example.name>mail</example.name>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.jboss.seam.examples-ee6.mail</groupId>
                                            <artifactId>mail-ear</artifactId>
                                            <type>ear</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>${project.build.directory}/${project.build.finalName}-exploded/${project.build.finalName}.ear</outputDirectory>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.jboss.seam.examples-ee6.mail</groupId>
                                            <artifactId>mail-web</artifactId>
                                            <type>war</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>${project.build.directory}/${project.build.finalName}-exploded/${project.build.finalName}.ear/${example.name}-web.war</outputDirectory>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.jboss.seam.examples-ee6.mail</groupId>
                                            <artifactId>mail-ejb</artifactId>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>${project.build.directory}/${project.build.finalName}-exploded/${project.build.finalName}.ear/${example.name}-ejb.jar</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        
    </profiles>
    <dependencyManagement>
    	<dependencies>
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-validator</artifactId>
    			<version>3.1.0.GA</version>
    			<scope>compile</scope>
    		</dependency>
    	</dependencies>
    </dependencyManagement>
</project>
