<!--

    Copyright (c) 2013-2016, The SeedStack authors <http://seedstack.org>

    This Source Code Form is subject to the terms of the Mozilla Public
    License, v. 2.0. If a copy of the MPL was not distributed with this
    file, You can obtain one at http://mozilla.org/MPL/2.0/.

-->
<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>
    <parent>
        <groupId>org.seedstack.poms</groupId>
        <artifactId>poms</artifactId>
        <version>3.0.0</version>
    </parent>

    <artifactId>parent-internal</artifactId>
    <packaging>pom</packaging>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <compatibility.skip>false</compatibility.skip>
        <compatibility.groupId>${project.groupId}</compatibility.groupId>
        <compatibility.artifactId>${project.artifactId}</compatibility.artifactId>
        <compatibility.version>MISSING_COMPATIBILITY_REFERENCE_VERSION</compatibility.version>
    </properties>

    <build>
        <testResources>
            <testResource>
                <directory>src/it/resources</directory>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven-dependency-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>${maven-antrun-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>${maven-assembly-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>${build-helper-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>reserve-network-ports</id>
                            <goals>
                                <goal>reserve-network-port</goal>
                            </goals>
                            <configuration>
                                <portNames>
                                    <portName>tomcat.http.port</portName>
                                    <portName>seed.shell.port</portName>
                                    <portName>seed.ws.port</portName>
                                </portNames>
                            </configuration>
                        </execution>
                        <execution>
                            <id>add-it-sources</id>
                            <goals>
                                <goal>add-test-source</goal>
                            </goals>
                            <configuration>
                                <sources>
                                    <source>src/it/java</source>
                                </sources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                    <configuration>
                        <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
                        <systemProperties>
                            <java.awt.headless>true</java.awt.headless>
                            <tomcat.http.port>${tomcat.http.port}</tomcat.http.port>
                            <seed.shell.port>${seed.shell.port}</seed.shell.port>
                            <seed.ws.port>${seed.ws.port}</seed.ws.port>
                        </systemProperties>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                    <configuration>
                        <dataFile>${project.build.directory}/jacoco-all.exec</dataFile>
                        <outputDirectory>${project.reporting.outputDirectory}/jacoco-all</outputDirectory>
                    </configuration>
                    <executions>
                        <execution>
                            <id>prepare-test-agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>prepare-it-agent</id>
                            <goals>
                                <goal>prepare-agent-integration</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>merge-coverage</id>
                            <goals>
                                <goal>merge</goal>
                            </goals>
                            <phase>post-integration-test</phase>
                            <configuration>
                                <fileSets>
                                    <fileSet>
                                        <directory>${project.build.directory}</directory>
                                        <includes>
                                            <include>jacoco.exec</include>
                                            <include>jacoco-it.exec</include>
                                        </includes>
                                    </fileSet>
                                </fileSets>
                                <destFile>${project.build.directory}/jacoco-all.exec</destFile>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.eluder.coveralls</groupId>
                    <artifactId>coveralls-maven-plugin</artifactId>
                    <version>${coveralls-maven-plugin.version}</version>
                    <configuration>
                        <relativeReportDirs>
                            <relativeReportDir>jacoco-all</relativeReportDir>
                        </relativeReportDirs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.github.siom79.japicmp</groupId>
                    <artifactId>japicmp-maven-plugin</artifactId>
                    <version>${japicmp-maven-plugin.version}</version>
                    <configuration>
                        <oldVersion>
                            <dependency>
                                <groupId>${compatibility.groupId}</groupId>
                                <artifactId>${compatibility.artifactId}</artifactId>
                                <version>${compatibility.version}</version>
                            </dependency>
                        </oldVersion>
                        <newVersion>
                            <file>
                                <path>${project.build.directory}/${project.build.finalName}.jar</path>
                            </file>
                        </newVersion>
                        <parameter>
                            <excludes>
                                <exclude>*.internal.*</exclude>
                            </excludes>
                            <onlyModified>true</onlyModified>
                            <onlyBinaryIncompatible>true</onlyBinaryIncompatible>
                            <accessModifier>protected</accessModifier>
                            <breakBuildOnModifications>false</breakBuildOnModifications>
                            <breakBuildOnBinaryIncompatibleModifications>true
                            </breakBuildOnBinaryIncompatibleModifications>
                            <includeSynthetic>false</includeSynthetic>
                            <ignoreMissingClasses>false</ignoreMissingClasses>
                        </parameter>
                        <skip>${compatibility.skip}</skip>
                        <skipPomModules>true</skipPomModules>
                    </configuration>
                    <executions>
                        <execution>
                            <id>verify-compatibility</id>
                            <goals>
                                <goal>cmp</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>attach-javadoc</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </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-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.eluder.coveralls</groupId>
                <artifactId>coveralls-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>javadoc</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>compatibility</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.siom79.japicmp</groupId>
                        <artifactId>japicmp-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
