<?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>

    <groupId>org.jeeventstore</groupId>
    <artifactId>jeeventstore-parent</artifactId>
    <version>1.1.9</version>

    <packaging>pom</packaging>

    <name>JEEventStore: Parent Module</name>

    <description>JEEventStore is an event store using Java EE technology stack.</description>
    <url>https://github.com/JEEventStore/JEEventStore</url>
    <licenses>
        <license>
            <name>The MIT License (MIT)</name>
            <url>https://github.com/JEEventStore/JEEventStore/blob/master/LICENSE</url>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>Alexander Langer</name>
            <email>alexander.langer@redrainbow.de</email>
            <organization>Red Rainbow IT Solutions GmbH</organization>
            <organizationUrl>http://www.redrainbow.de</organizationUrl>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:git://github.com/JEEventStore/JEEventStore.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/JEEventStore/JEEventStore.git</developerConnection>
        <url>http://github.com/JEEventStore/JEEventStore/tree/master</url>
        <tag>HEAD</tag>
    </scm>

    <modules>
        <module>bom-all</module>
        <module>testutils</module>
        <module>testhelpers</module>
        <module>core</module>
        <module>core-async-ejb</module>
        <module>core-sync-ejb</module>
        <module>serial-gson</module>
        <module>serial-gson-ejb</module>
        <module>persistence-jpa</module>
        <module>persistence-jpa-ejb</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.target>1.7</maven.compiler.target>
        <maven.compiler.source>1.7</maven.compiler.source>
        <version.compiler.plugin>2.3.1</version.compiler.plugin>
        <version.ejb.plugin>2.3</version.ejb.plugin>

        <!-- Tests -->
        <version.testng>6.8</version.testng>
        <version.shrinkwrap.resolver>2.0.0</version.shrinkwrap.resolver>
        <version.org.jboss.arquillian>1.1.1.Final</version.org.jboss.arquillian>
        <version.org.jboss.as>7.1.2.Final</version.org.jboss.as>
        <glassfish.database>derby</glassfish.database>
        <tomee.version>1.5.2</tomee.version>
        <tomee.classifier>plus</tomee.classifier>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-depchain</artifactId>
            <type>pom</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.arquillian.testng</groupId>
            <artifactId>arquillian-testng-container</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.arquillian.protocol</groupId>
            <artifactId>arquillian-protocol-servlet</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>javax.enterprise</groupId>
                <artifactId>cdi-api</artifactId>
                <version>1.0-SP4</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>${version.testng}</version>
                <scope>test</scope>
            </dependency>

            <!-- Override dependency resolver with test version.
            This must go *BEFORE* the Arquillian BOM. -->
            <dependency>
                <groupId>org.jboss.shrinkwrap.resolver</groupId>
                <artifactId>shrinkwrap-resolver-bom</artifactId>
                <version>${version.shrinkwrap.resolver}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>

            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>${version.org.jboss.arquillian}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>

            <dependency>
                <groupId>org.jboss.arquillian.testng</groupId>
                <artifactId>arquillian-testng-container</artifactId>
                <version>${version.org.jboss.arquillian}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.jboss.arquillian.protocol</groupId>
                <artifactId>arquillian-protocol-servlet</artifactId>
                <version>${version.org.jboss.arquillian}</version>
                <scope>test</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <build>

        <plugins>
            <!-- Configure the maven-ejb-plugin to use EJB 3.1 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <version>${version.ejb.plugin}</version>
                <configuration>
                    <ejbVersion>3.1</ejbVersion>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>true</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>

        </plugins>

        <pluginManagement>
            <plugins>

                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${version.compiler.plugin}</version>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                    </configuration>
                </plugin>

                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.16</version>
                    <configuration>
                        <!-- required due to a bug in glassfish-embedded: "Already bootstrapped"-->
                        <!-- https://github.com/arquillian/arquillian-container-glassfish/issues/24 -->
                        <reuseForks>false</reuseForks>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>

    </build>

    <profiles>
        <profile>
            <!-- The default profile skips all tests, though you can tune 
            it to run just unit tests based on a custom pattern -->
            <!-- Seperate profiles are provided for running all tests, including 
            Arquillian tests that execute in the specified container -->
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <skipTests>true</skipTests>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>javax</groupId>
                    <artifactId>javaee-api</artifactId>
                    <version>6.0</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>release</id>
            <properties>
                <skipTests>true</skipTests>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>javax</groupId>
                    <artifactId>javaee-api</artifactId>
                    <version>6.0</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.4</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.4</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>C77774C8</keyname>
                                    <useAgent>true</useAgent>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <!-- An optional Arquillian testing profile that executes tests 
            in a remote JBoss AS instance -->
            <!-- Run with: mvn clean test -Parq-jbossas-remote -->
            <id>arq-jbossas-remote</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.spec</groupId>
                    <artifactId>jboss-javaee-6.0</artifactId>
                    <type>pom</type>
                </dependency>

                <dependency>
                    <groupId>org.jboss.as</groupId>
                    <artifactId>jboss-as-arquillian-container-remote</artifactId>
                    <version>${version.org.jboss.as}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <!--arquillian.launch>jbossas-remote</arquillian.launch-->
                                <defaultProtocol>
                                    <![CDATA[<defaultProtocol type="Servlet 3.0" />]]>
                                </defaultProtocol>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <!-- An optional Arquillian testing profile that executes tests 
            in an embedded Glassfish instance -->
            <!-- Run with: mvn clean test -Parq-glassfish-embedded -->
            <id>arq-glassfish-embedded</id>
            <dependencies>

                <dependency>
                    <groupId>org.glassfish.main.extras</groupId>
                    <artifactId>glassfish-embedded-all</artifactId>
                    <version>3.1.2.2</version>
                </dependency>

                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
                    <version>1.0.0.CR4</version>
                    <scope>test</scope>
                </dependency>

                <dependency>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                    <version>1.2.16</version>
                </dependency>

                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>5.1.26</version>
                </dependency>

                <dependency>
                    <groupId>postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <version>9.1-901-1.jdbc4</version>
                </dependency>

                <!-- Java EE 6.0 API.  Here's why we are not using javaee-api:
                https://community.jboss.org/wiki/WhatsTheCauseOfThisExceptionJavalangClassFormatErrorAbsentCode -->
                <dependency>
                    <groupId>org.jboss.spec</groupId>
                    <artifactId>jboss-javaee-6.0</artifactId>
                    <version>1.0.0.Final</version>
                    <type>pom</type>
                    <scope>provided</scope>
                </dependency>

            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <arquillian.launch>glassfish-embedded</arquillian.launch>
                                <glassfishDatabase>${glassfish.database}</glassfishDatabase>
                                <java.util.logging.config.file>
                                    ${basedir}/src/test/resources/customlogging.properties
                                </java.util.logging.config.file>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>


        <profile>
            <!-- An optional Arquillian testing profile that executes tests 
            in a remote Apache TomEE instance -->
            <!-- Run with: mvn clean test -Parq-tomee-embedded -->
            <id>arq-tomee-embedded</id>
            <dependencies>

                <dependency>
                    <groupId>org.apache.openejb</groupId>
                    <artifactId>javaee-api</artifactId>
                    <version>6.0-5</version>
                </dependency>

                <dependency>
                    <groupId>org.apache.openejb</groupId>
                    <artifactId>apache-tomee</artifactId>
                    <version>${tomee.version}</version>
                    <classifier>${tomee.classifier}</classifier>
                    <type>zip</type>
                </dependency>

                <dependency>
                    <groupId>org.apache.openejb</groupId>
                    <artifactId>arquillian-tomee-embedded</artifactId>
                    <version>${tomee.version}</version>
                    <scope>test</scope>
                </dependency>

            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <tomee.classifier>${tomee.classifier}</tomee.classifier>
                                <tomee.version>${tomee.version}</tomee.version>
                                <tomee.httpPort>-1</tomee.httpPort>
                                <tomee.stopPort>-1</tomee.stopPort>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

</project>
