<!--

    Copyright (C) 2015 Stratio (http://stratio.com)

    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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.stratio</groupId>
    <artifactId>parent</artifactId>
    <version>0.9.0</version>
    <packaging>pom</packaging>
    <description>The Stratio pom</description>
    <name>stratio-parent-pom</name>
    <url>https://github.com/Stratio</url>

    <distributionManagement>
        <repository>
            <id>releases</id>
            <name>Stratio releases</name>
            <url>http://sodio.stratio.com/repository/releases/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>Stratio snapshots</name>
            <url>http://sodio.stratio.com/repository/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <organization>
        <name>Stratio</name>
        <url>http://stratio.com</url>
    </organization>

    <inceptionYear>2015</inceptionYear>

    <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>
        <url>https://github.com/Stratio/</url>
        <connection>scm:git:git@github.com:Stratio/stratio-parent.git</connection>
        <developerConnection>scm:git:git@github.com:Stratio/stratio-parent.git
        </developerConnection>
        <tag>HEAD</tag>
    </scm>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>6.9.9</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <developers>
        <developer>
            <id>jdelgado</id>
            <name>Javier Delgado</name>
            <email>jdelgado@stratio.com</email>
            <roles>
                <role>architect</role>
                <role>developer</role>
                <role>maintainer</role>
            </roles>
        </developer>
    </developers>

    <build>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh</artifactId>
                <version>2.10</version>
            </extension>
        </extensions>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.7.5.201505241946</version>
                    <configuration>
                        <dataFile>${jacoco.dataFile}</dataFile>
                        <includes>
                            <include>com/stratio/**</include>
                        </includes>
                        <excludes>
                            <exclude>**/HelpMojo.*</exclude>
                        </excludes>
                        <fileSets>
                            <fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">
                                <directory>${project.basedir}</directory>
                                <includes>
                                    <include>**/target/*.exec</include>
                                </includes>
                            </fileSet>
                        </fileSets>
                        <destFile>${project.build.directory}/jacoco.exec</destFile>
                    </configuration>
                    <executions>
                        <execution>
                            <id>unit-test-coverage</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <phase>process-test-classes</phase>
                            <configuration>
                                <skip>${skipUTs}</skip>
                                <destFile>${basedir}/target/jacocoUT.exec</destFile>
                                <propertyName>jacoco-UT-argline</propertyName>
                            </configuration>
                        </execution>
                        <execution>
                            <id>integration-test-coverage</id>
                            <goals>
                                <goal>prepare-agent-integration</goal>
                            </goals>
                            <configuration>
                                <skip>${skipITs}</skip>
                                <destFile>${basedir}/target/jacocoIT.exec</destFile>
                                <propertyName>jacoco-IT-argline</propertyName>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>2.19.1</version>
                    <configuration>
                        <skipTests>${skipITs}</skipTests>
                        <argLine>
                            ${jacoco-IT-argline}
                        </argLine>
                        <reportsDirectory>${project.build.directory}/failsafe-reports</reportsDirectory>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.19.1</version>
                    <configuration>
                        <skipTests>${skipUTs}</skipTests>
                        <argLine>
                            ${jacoco-UT-argline}
                        </argLine>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>2.11</version>
                    <configuration>
                        <mapping>
                            <java>SLASHSTAR_STYLE</java>
                            <scala>SLASHSTAR_STYLE</scala>
                        </mapping>
                        <useDefaultExcludes>true</useDefaultExcludes>
                        <header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</header>
                        <properties>
                            <owner>${project.organization.name}</owner>
                            <email>${project.organization.url}</email>
                            <failOnMissingHeader>true</failOnMissingHeader>
                        </properties>
                        <includes>
                            <include>**/src/**</include>
                        </includes>
                        <excludes>
                            <exclude>**/.*/**</exclude>
                            <exclude>**/_themes/stratio/**</exclude>
                            <exclude>**/*.rst</exclude>
                            <exclude>**/*.feature</exclude>
                            <exclude>**/README*</exclude>
                            <exclude>**/node*/**</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>scala-maven-plugin</artifactId>
                    <version>3.2.2</version>
                    <configuration>
                        <checkMultipleScalaVersions>false</checkMultipleScalaVersions>
                        <recompileMode>modified-only</recompileMode>
                    </configuration>
                    <executions>
                        <execution>
                            <id>default</id>
                            <goals>
                                <goal>add-source</goal>
                                <goal>compile</goal>
                                <goal>testCompile</goal>
                                <goal>doc</goal>
                                <goal>doc-jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.5</version>
                    <configuration>
                        <useIncrementalCompilation>false</useIncrementalCompilation>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>1.10</version>
                    <executions>
                        <execution>
                            <id>parse-version</id>
                            <goals>
                                <goal>parse-version</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>confluence-property</id>
                            <goals>
                                <goal>regex-property</goal>
                            </goals>
                            <configuration>
                              <name>confluence.version</name>
                              <value>${parsedVersion.majorVersion}x${parsedVersion.minorVersion}</value>
                              <regex>(.*)</regex>
                              <replacement>$1</replacement>
                            </configuration>
                        </execution>
                        <execution>
                            <id>parse-scala-version</id>
                            <goals>
                                <goal>regex-property</goal>
                            </goals>
                            <configuration>
                                <name>scala.binary.package.version</name>
                                <value>${scala.binary.version}</value>
                                <regex>(.*)[\._](.*)</regex>
                                <replacement>$1$2</replacement>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>sonatype</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>OSSRH</id>
            <build>
                <plugins>
                     <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <version>1.4.1</version>
                        <executions>
                            <execution>
                                <id>enforce</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <requireProperty>
                                            <property>project.description</property>
                                            <message>Project description must be specified (requirement for OSSRH).</message>
                                        </requireProperty>
                                        <requireProperty>
                                            <property>project.name</property>
                                            <message>Project name must be specified (requirement for OSSRH).</message>
                                        </requireProperty>
                                        <requireProperty>
                                            <property>project.url</property>
                                            <message>Project url must be specified (requirement for OSSRH).</message>
                                        </requireProperty>
                                        <requireProperty>
                                            <property>project.licenses</property>
                                            <message>At least on license must be specified (requirement for OSSRH).</message>
                                        </requireProperty>
                                        <requireProperty>
                                            <property>project.developers</property>
                                            <message>At least one developer must be specified (requirement for OSSRH).</message>
                                        </requireProperty>
                                        <requireProperty>
                                            <property>project.scm.connection</property>
                                            <message>scm section should be defined in project (requirement for OSSRH).</message>
                                        </requireProperty>
                                      </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
