<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
    
     http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->
<!-- $Rev$ $Date$ -->

<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.apache.geronimo.samples</groupId>
        <artifactId>samples-parent</artifactId>
        <version>2.2</version>
    </parent>
    <artifactId>samples</artifactId>
    <name>Geronimo Samples :: Samples</name>
    <packaging>pom</packaging>
    <description>
        Geronimo Samples.
    </description>

    <properties>
        <gbeanDeployerBootstrap>org.apache.geronimo.framework/geronimo-gbean-deployer-bootstrap/${geronimoVersion}/car</gbeanDeployerBootstrap>
        <gbeanDeployer>org.apache.geronimo.framework/geronimo-gbean-deployer/${geronimoVersion}/car</gbeanDeployer>
        <j2eeDeployer>org.apache.geronimo.configs/j2ee-deployer/${geronimoVersion}/car</j2eeDeployer>
        <clientDeployer>org.apache.geronimo.configs/client-deployer/${geronimoVersion}/car</clientDeployer>
        <connectorDeployer>org.apache.geronimo.configs/connector-deployer/${geronimoVersion}/car</connectorDeployer>
        <openejbDeployer>org.apache.geronimo.configs/openejb-deployer/${geronimoVersion}/car</openejbDeployer>
        <openejbcorbaDeployer>org.apache.geronimo.configs/openejb-corba-deployer/${geronimoVersion}/car</openejbcorbaDeployer>
        <axisDeployer>org.apache.geronimo.configs/axis-deployer/${geronimoVersion}/car</axisDeployer>
        <cxfDeployer>org.apache.geronimo.configs/cxf-deployer/${geronimoVersion}/car</cxfDeployer>
        <axis2Deployer>org.apache.geronimo.configs/axis2-deployer/${geronimoVersion}/car</axis2Deployer>
        <tomcatDeployer>org.apache.geronimo.configs/tomcat6-deployer/${geronimoVersion}/car</tomcatDeployer>
        <jettyDeployer>org.apache.geronimo.configs/${jetty}-deployer/${geronimoVersion}/car</jettyDeployer>
        <jasperDeployer>org.apache.geronimo.configs/jasper-deployer/${geronimoVersion}/car</jasperDeployer>
        <jpaDeployer>org.apache.geronimo.configs/persistence-jpa10-deployer/${geronimoVersion}/car</jpaDeployer>

    </properties>

    <modules>
        <module>sample-datasource</module>
        <module>customer</module>
        <!--
                <module>async-http</module>
        -->
        <module>bank</module>
        <module>calculator</module>
        <module>dbtester</module>
        <module>inventory</module>
        <module>jaxws-calculator</module>
        <module>jms-mdb</module>
        <module>ldap-sample-app</module>
        <module>myphonebook</module>
        <module>mytime</module>
        <module>sendmail</module>
        <module>timereport</module>
        <module>jsp-examples</module>
        <module>servlet-examples</module>
        <module>app-per-port</module>
        <module>csa-activemq</module>
        <module>DataCDInfo</module>
        <module>all-samples</module>
    </modules>


    <dependencies>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jsp_2.1_spec</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-ejb_3.0_spec</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-servlet_2.5_spec</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>${pom.basedir}/src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.geronimo.samples</groupId>
                            <artifactId>buildutil</artifactId>
                            <version>${version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <warSourceDirectory>${pom.basedir}/src/main/webapp</warSourceDirectory>
                    <archiveClasses>true</archiveClasses>
                    <archive>
                        <!-- Do not include META-INF/maven to avoid long file problems on windows -->
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>

                    <!--
                    HACK: Include legal files explicity, otherwise they will end up in the wrong path
                          or in another jar file in the war.

                    NOTE: targetPath is broken for webResources (as documented)
                    -->
                    <webResources>
                        <resource>
                            <directory>${project.build.outputDirectory}</directory>
                            <includes>
                                <include>META-INF/LICENSE*</include>
                                <include>META-INF/NOTICE*</include>
                                <include>META-INF/DISCLAIMER*</include>
                            </includes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <archive>
                        <!-- Do not include META-INF/maven to avoid long file problems on windows -->
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.geronimo.buildsupport</groupId>
                <artifactId>car-maven-plugin</artifactId>
                <version>${geronimoVersion}</version>
                <!-- Install as extention to allow 'car' packaging to be used. -->
                <extensions>true</extensions>
                <configuration>
                    <archive>
                        <!-- Do not include META-INF/maven to avoid long file problems on windows -->
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>
                    <osiApproved>true</osiApproved>
                    <commonInstance>
                        <plugin-artifact>
                            <jvm-version>1.5</jvm-version>
                            <jvm-version>1.6</jvm-version>
                            <source-repository>~/.m2/repository/</source-repository>
                            <source-repository>http://repo1.maven.org/maven2/</source-repository>
                            <source-repository>http://people.apache.org/repo/m2-snapshot-repository/</source-repository>
                            <source-repository>http://people.apache.org/repo/m2-incubating-repository/</source-repository>
                        </plugin-artifact>
                    </commonInstance>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- This profile creates a sample template.
              Use -DsampleName to specify the name of your sample.
              Use -DsampleVersion to specify the version for your sample
        -->
        <profile>
            <id>create</id>
            <build>
                <defaultGoal>validate</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.1</version>
                        <dependencies>
                            <dependency>
                                <groupId>oro</groupId>
                                <artifactId>oro</artifactId>
                                <version>2.0.8</version>
                            </dependency>
                            <dependency>
                                <groupId>ant</groupId>
                                <artifactId>ant-apache-oro</artifactId>
                                <version>1.6.4</version>
                            </dependency>
                            <dependency>
                                <groupId>ant</groupId>
                                <artifactId>ant-optional</artifactId>
                                <version>1.5.3-1</version>
                            </dependency>
                        </dependencies>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <phase>validate</phase>
                                <configuration>
                                    <tasks>
                                        <condition property="mvn.exe" value="mvn.bat" else="mvn">
                                            <os family="windows" />
                                        </condition>
                                        <exec executable="${mvn.exe}">
                                            <arg value="archetype:create" />
                                            <arg value="-DarchetypeGroupId=org.apache.geronimo.samples" />
                                            <arg value="-DarchetypeArtifactId=geronimo-samples-archetype" />
                                            <arg value="-DarchetypeVersion=${version}" />
                                            <arg value="-DartifactId=${sampleName}" />
                                            <arg value="-Dversion=${sampleVersion}" />
                                        </exec>
                                        <move file="${sampleName}/sample-ear" tofile="${sampleName}/${sampleName}-ear" />
                                        <move file="${sampleName}/sample-ejb" tofile="${sampleName}/${sampleName}-ejb" />
                                        <move file="${sampleName}/sample-war" tofile="${sampleName}/${sampleName}-war" />
                                        <move file="${sampleName}/sample-jetty" tofile="${sampleName}/${sampleName}-jetty" />
                                        <move file="${sampleName}/sample-tomcat" tofile="${sampleName}/${sampleName}-tomcat" />
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
