<!--
  ~ Copyright (c) 2008-2018, Hazelcast, Inc. All Rights Reserved.
  ~
  ~ Licensed 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.
  -->

<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>
    <packaging>pom</packaging>
    <name>hazelcast-jet-root</name>
    <description>Hazelcast Jet Distributed Data Processing Engine</description>
    <url>http://jet.hazelcast.org/</url>

    <groupId>com.hazelcast.jet</groupId>
    <artifactId>hazelcast-jet-root</artifactId>
    <version>0.7.2</version>

    <modules>
        <module>hazelcast-jet-all</module>
        <module>hazelcast-jet-distribution</module>
        <module>hazelcast-jet-client-protocol</module>
        <module>hazelcast-jet-core</module>
        <module>hazelcast-jet-kafka</module>
        <module>hazelcast-jet-hadoop</module>
        <module>hazelcast-jet-spring</module>
        <module>hazelcast-jet-avro</module>
    </modules>

    <repositories>
        <repository>
            <id>snapshot-repository</id>
            <name>Maven2 Snapshot Repository</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
        <repository>
            <id>main-repo</id>
            <url>http://repo1.maven.org/maven2/</url>
        </repository>
        <repository>
            <id>backup-repo</id>
            <url>http://repo2.maven.org/maven2/</url>
        </repository>
        <repository>
            <id>release-repository</id>
            <name>release repository</name>
            <url>https://oss.sonatype.org/content/repositories/releases</url>
        </repository>
    </repositories>

    <properties>
        <argLine> <!-- surefire parameters -->
            -Xmx1G
            -Xms1G
            -XX:+AlwaysPreTouch
            -Dhazelcast.phone.home.enabled=false
            -Dhazelcast.mancenter.enabled=false
            -Dhazelcast.logging.type=log4j
            -Dhazelcast.test.use.network=false
            -Djava.net.preferIPv4Stack=true
        </argLine>
        <main.basedir>${project.basedir}</main.basedir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <jdk.version>1.8</jdk.version>
        <target.dir>target</target.dir>
        <maven.build.timestamp.format>yyyyMMdd</maven.build.timestamp.format>
        <timestamp>${maven.build.timestamp}</timestamp>
        <hazelcast.version>3.10.5</hazelcast.version>
        <hazelcast.protocol.version>1.6.0</hazelcast.protocol.version>

        <maven.compiler.plugin.version>3.7.0</maven.compiler.plugin.version>
        <maven.jar.plugin.version>2.4</maven.jar.plugin.version>
        <maven.source.plugin.version>2.2.1</maven.source.plugin.version>
        <maven.javadoc.plugin.version>3.0.1</maven.javadoc.plugin.version>
        <maven.gpg.plugin.version>1.4</maven.gpg.plugin.version>
        <maven.assembly.plugin.version>3.0.0</maven.assembly.plugin.version>
        <maven.bundle.plugin.version>2.4.0</maven.bundle.plugin.version>
        <maven.shade.plugin.version>2.2</maven.shade.plugin.version>
        <maven.dependency.plugin.version>2.6</maven.dependency.plugin.version>
        <maven.git.commit.id.plugin.version>2.1.10</maven.git.commit.id.plugin.version>

        <maven.enforcer.plugin.version>3.0.0-M1</maven.enforcer.plugin.version>
        <maven.surefire.plugin.version>2.20.1</maven.surefire.plugin.version>
        <maven.spotbugs.plugin.version>3.1.6</maven.spotbugs.plugin.version>
        <maven.checkstyle.plugin.version>3.0.0</maven.checkstyle.plugin.version>
        <maven.sonar.plugin.version>3.3.0.603</maven.sonar.plugin.version>
        <maven.jacoco.plugin.version>0.7.9</maven.jacoco.plugin.version>

        <!-- optional dependencies -->
        <jms.api.version>2.0.1</jms.api.version>
        <jsr107.api.version>1.0.0</jsr107.api.version> <!-- JCache -->
        <jsr250.api.version>1.2</jsr250.api.version> <!-- javax.annotations -->
        <log4j.version>1.2.12</log4j.version>
        <log4j2.version>2.3</log4j2.version>
        <slf4j.api.version>1.6.6</slf4j.api.version>
        <hazelcast.aws.version>2.0.0</hazelcast.aws.version>
        <osgi.version>4.2.0</osgi.version>
        <hadoop.version>2.8.3</hadoop.version>
        <spring.version>4.3.0.RELEASE</spring.version>

        <!-- test dependencies -->
        <junit.version>4.12</junit.version>
        <hamcrest.version>1.3</hamcrest.version>
        <mockito.version>1.10.19</mockito.version>
        <powermock.version>1.6.3</powermock.version>
        <bytebuddy.version>1.6.12</bytebuddy.version>

        <sonar.jacoco.jar>${basedir}/lib/jacocoagent.jar</sonar.jacoco.jar>
        <!--<sonar.phase>post-integration-test</sonar.phase>-->
        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
        <sonar.language>java</sonar.language>
        <sonar.verbose>true</sonar.verbose>
    </properties>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <connection>scm:git:git://github.com/hazelcast/hazelcast.git</connection>
        <developerConnection>scm:git:git@github.com:hazelcast/hazelcast.git</developerConnection>
        <url>https://github.com/hazelcast/hazelcast/</url>
    </scm>

    <developers>
        <developer>
            <id>jet-team</id>
            <name>Hazelcast Jet Team</name>
            <email>jet@hazelcast.com</email>
        </developer>
    </developers>

    <issueManagement>
        <system>Github</system>
        <url>https://github.com/hazelcast/hazelcast-jet/issues</url>
    </issueManagement>
    <organization>
        <name>Hazelcast, Inc.</name>
        <url>http://www.hazelcast.com/</url>
    </organization>

    <distributionManagement>
        <repository>
            <id>release-repository</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
        <snapshotRepository>
            <id>snapshot-repository</id>
            <name>Maven2 Snapshot Repository</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <uniqueVersion>false</uniqueVersion>
        </snapshotRepository>
    </distributionManagement>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.hazelcast</groupId>
                <artifactId>hazelcast</artifactId>
                <version>${hazelcast.version}</version>
            </dependency>
            <dependency>
                <groupId>com.hazelcast</groupId>
                <artifactId>hazelcast-client</artifactId>
                <version>${hazelcast.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>annotations</artifactId>
            <version>3.0.0</version>
            <scope>provided</scope>
        </dependency>

        <!-- test dependencies -->
        <dependency>
            <groupId>com.hazelcast</groupId>
            <artifactId>hazelcast</artifactId>
            <scope>test</scope>
            <version>${hazelcast.version}</version>
            <classifier>tests</classifier>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <version>${hamcrest.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
            <version>${bytebuddy.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency> <!-- required for mockito -->
            <groupId>javax.cache</groupId>
            <artifactId>cache-api</artifactId>
            <version>${jsr107.api.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.properties</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven.enforcer.plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.5.2</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven.source.plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <index>true</index>
                        <compress>true</compress>
                        <manifest>
                            <addClasspath>false</addClasspath>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <!--<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>-->
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    <runOrder>failedfirst</runOrder>
                    <forkCount>4</forkCount>
                    <failIfNoTests>false</failIfNoTests>
                    <trimStackTrace>false</trimStackTrace>
                    <argLine>
                        ${argLine}
                    </argLine>
                    <includes>
                        <include>/com/hazelcast/jet/**/**.java</include>
                    </includes>
                    <excludedGroups>
                        com.hazelcast.test.annotation.SlowTest,com.hazelcast.test.annotation.NightlyTest
                    </excludedGroups>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${maven.spotbugs.plugin.version}</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <failOnError>true</failOnError>
                    <excludeFilterFile>${main.basedir}/spotbugs/spotbugs-exclude.xml</excludeFilterFile>
                    <spotbugsXmlOutput>true</spotbugsXmlOutput>
                    <xmlOutput>true</xmlOutput>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc.plugin.version}</version>
                <configuration>
                    <doclint>-missing</doclint>
                    <maxmemory>1024</maxmemory>
                    <detectJavaApiLink>true</detectJavaApiLink>
                    <excludePackageNames>
                        *.impl:*.internal
                    </excludePackageNames>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven.checkstyle.plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>8.10.1</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>checkstyle</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <configLocation>${main.basedir}/checkstyle/checkstyle.xml</configLocation>
                    <suppressionsLocation>${main.basedir}/checkstyle/suppressions.xml</suppressionsLocation>
                    <headerLocation>${main.basedir}/checkstyle/ClassHeader.txt</headerLocation>
                    <enableRSS>false</enableRSS>
                    <linkXRef>true</linkXRef>
                    <consoleOutput>true</consoleOutput>
                    <failsOnError>true</failsOnError>
                    <failOnViolation>true</failOnViolation>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <enableRulesSummary>true</enableRulesSummary>
                    <propertyExpansion>main.basedir=${main.basedir}</propertyExpansion>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>${maven.shade.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven.jar.plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <profiles>
        <profile>
            <id>nightly</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <forkCount>1</forkCount>
                            <excludedGroups></excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>test-coverage</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${maven.jacoco.plugin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <testFailureIgnore>true</testFailureIgnore>
                            <argLine>@{argLine}</argLine>
                            <excludedGroups>
                                com.hazelcast.test.annotation.SlowTest,
                                com.hazelcast.test.annotation.NightlyTest,
                                com.hazelcast.jet.test.IgnoredForCoverage
                            </excludedGroups>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                        <version>${maven.sonar.plugin.version}</version>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <properties>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.3</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>release-repository</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven.gpg.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>test-enterprise</id>
            <repositories>
                <repository>
                    <id>private-repository</id>
                    <name>Hazelcast Private Repository</name>
                    <url>https://repository-hazelcast-l337.forge.cloudbees.com/release/</url>
                </repository>
                <repository>
                    <id>private-snapshot-repository</id>
                    <name>Hazelcast Private Repository</name>
                    <url>https://repository-hazelcast-l337.forge.cloudbees.com/snapshot/</url>
                </repository>
            </repositories>
            <dependencies>
                <dependency>
                    <groupId>com.hazelcast</groupId>
                    <artifactId>hazelcast-enterprise-all</artifactId>
                    <version>${hazelcast.version}</version>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
