<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.mule.tools</groupId>
    <artifactId>mule-apikit-parent</artifactId>
    <version>1.2.2</version>
    <packaging>pom</packaging>
    <name>APIKit Parent POM</name>

    <modules>
        <module>mule-apikit-common</module>
        <module>parser-wrapper</module>
        <module>mule-apikit-module-spi</module>
        <module>mule-apikit-tools</module>
        <module>mule-apikit-module</module>
    </modules>

    <properties>
        <!-- REVISE VERSIONS USED IN RELEASE -->

        <!-- MULE -->
        <mule.version>4.1.5</mule.version>
        <mule.core.version>4.1.5</mule.core.version>
        <mule.api.version>1.1.5</mule.api.version>
        <mule.http.connector.version>1.4.2</mule.http.connector.version>

        <mule.service.weave.version>2.1.8</mule.service.weave.version>
        <mule.plugin.maven.plugin.version>1.1.6</mule.plugin.maven.plugin.version>
        <mule.http.service.version>1.1.5</mule.http.service.version>
        <mule.extensions.api.version>1.1.6</mule.extensions.api.version>
        <mule.service.scheduler.version>1.1.7</mule.service.scheduler.version>
        <project.reactor.version>3.2.0.M1</project.reactor.version>

        <!-- PARSERS -->
        <amfVersion>3.1.3</amfVersion>
        <amfXmlExtensionVersion>1.2.1</amfXmlExtensionVersion>
        <ramlParserV1Version>0.8.29</ramlParserV1Version>
        <ramlParserV2Version>1.0.29</ramlParserV2Version>

        <!-- MISC -->
        <licensePath>LICENSE_HEADER.txt</licensePath>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <formatterConfigPath>formatter.xml</formatterConfigPath>
        <formatterGoal>format</formatterGoal>
        <checkstyle.plugin.version>2.17</checkstyle.plugin.version>
        <javaFormatter.plugin.version>1.9.0</javaFormatter.plugin.version>
        <skipVerifications>false</skipVerifications>
        <javaVersion>1.8</javaVersion>

        <!-- TESRT -->
        <rest.assured.version>2.9.0</rest.assured.version>
        <hamcrest.version>1.3</hamcrest.version>

        <!-- SONAR -->
        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
        <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
        <sonar.jacoco.reportPaths>target/jacoco.exec</sonar.jacoco.reportPaths>
        <sonar.language>java</sonar.language>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- AMF -->
            <dependency>
                <groupId>com.github.amlorg</groupId>
                <artifactId>amf-client_2.12</artifactId>
                <version>${amfVersion}</version>
            </dependency>
            <dependency>
                <groupId>org.mule.amf</groupId>
                <artifactId>amf-xml-extension_2.12</artifactId>
                <version>${amfXmlExtensionVersion}</version>
            </dependency>

            <dependency>
                <groupId>org.raml</groupId>
                <artifactId>raml-parser</artifactId>
                <version>${ramlParserV1Version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.google.code.findbugs</groupId>
                        <artifactId>jsr305</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>com.google.guava</groupId>
                        <artifactId>guava</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>commons-lang</groupId>
                        <artifactId>commons-lang</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.raml</groupId>
                <artifactId>raml-parser-2</artifactId>
                <version>${ramlParserV2Version}</version>
                <exclusions>
                    <exclusion>
                        <groupId> org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>com.google.code.findbugs</groupId>
                        <artifactId>jsr305</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>com.google.guava</groupId>
                        <artifactId>guava</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>commons-lang</groupId>
                        <artifactId>commons-lang</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.googlecode.json-simple</groupId>
                <artifactId>json-simple</artifactId>
                <version>1.1.1</version>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.findbugs</groupId>
                <artifactId>jsr305</artifactId>
                <version>3.0.0</version>
                <!--required by raml-parser v1 & v2. Workaround for MULE-12439-->
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>25.0-jre</version>
                <!--required by raml-parser v1 & v2. Workaround for MULE-12439-->
            </dependency>
            <dependency>
                <groupId> org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.5</version>
                <!--required by raml-parser v1, v2 & http service. Workaround for MULE-12439-->
            </dependency>
            <dependency>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
                <version>2.4</version>
                <!--required by raml-parser v1, v2 & http service. Workaround for MULE-12439-->
            </dependency>

            <dependency>
                <groupId>com.jayway.restassured</groupId>
                <artifactId>rest-assured</artifactId>
                <version>${rest.assured.version}</version>
                <exclusions>
                    <!-- Excluding httpclient in order to use the version shipped by AMF -->
                    <exclusion>
                        <groupId>org.apache.httpcomponents</groupId>
                        <artifactId>httpclient</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.hamcrest</groupId>
                        <artifactId>hamcrest-core</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.hamcrest</groupId>
                        <artifactId>hamcrest-library</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-library</artifactId>
                <version>${hamcrest.version}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <distributionManagement>
        <repository>
            <id>mule-ee-releases</id>
            <name>MuleSoft Releases Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-releases/</url>
        </repository>
        <snapshotRepository>
            <id>mulesoft-snapshots</id>
            <name>MuleSoft Snapshots Repository</name>
            <url>https://repository-master.mulesoft.org/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>com.mycila.maven-license-plugin</groupId>
                <artifactId>maven-license-plugin</artifactId>
                <version>1.9.0</version>
                <configuration>
                    <header>${licensePath}</header>
                    <excludes>
                        <exclude>**/target/**</exclude>
                        <exclude>**/.gitignore</exclude>
                        <exclude>**/bower_components/**</exclude>
                        <exclude>.idea/**</exclude>
                        <exclude>**/*.yaml</exclude>
                        <exclude>**/*.raml</exclude>
                        <exclude>**/*.txt</exclude>
                        <exclude>**/*.json</exclude>
                        <exclude>**/*.out</exclude>
                        <exclude>**/*.xsd</exclude>
                        <exclude>**/*.xml</exclude>
                        <exclude>**/*.properties</exclude>
                        <exclude>**/*.md</exclude>
                        <exclude>**/*.woff</exclude>
                        <exclude>**/*.svg</exclude>
                        <exclude>**/*.ttf</exclude>
                        <exclude>**/*.otf</exclude>
                        <exclude>**/*.eot</exclude>
                        <exclude>**/spring.handlers</exclude>
                        <exclude>**/spring.schemas</exclude>
                        <exclude>**/*.html</exclude>
                        <exclude>**/*.css</exclude>
                        <exclude>**/*.js</exclude>
                        <exclude>**/*.groovy</exclude>
                        <exclude>**/build-number.txt</exclude>
                        <exclude>**/*.sh</exclude>
                    </excludes>
                    <mapping>
                        <java>SLASHSTAR_STYLE</java>
                    </mapping>
                    <strictCheck>true</strictCheck>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.mule.runtime</groupId>
                        <artifactId>mule-buildtools</artifactId>
                        <version>${mule.core.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>com.marvinformatics.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.7.201606060606</version>
                <configuration>
                    <destFile>${sonar.jacoco.reportPaths}</destFile>
                    <append>true</append>
                </configuration>
                <executions>
                    <execution>
                        <id>agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.3.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${checkstyle.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>com.marvinformatics.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <version>${javaFormatter.plugin.version}</version>
                    <configuration>
                        <compilerCompliance>${javaVersion}</compilerCompliance>
                        <compilerSource>${javaVersion}</compilerSource>
                        <compilerTargetPlatform>${javaVersion}</compilerTargetPlatform>
                        <configFile>${basedir}/${formatterConfigPath}</configFile>
                        <configJsFile>${basedir}/${formatterConfigPath}</configJsFile>
                        <aggregator>false</aggregator>
                        <executionRoot>true</executionRoot>
                    </configuration>
                    <executions>
                        <execution>
                            <id>apply-format</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>${formatterGoal}</goal>
                            </goals>
                            <configuration>
                                <skipFormatting>${skipVerifications}</skipFormatting>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>integration-tests</id>
            <modules>
                <module>mule-apikit-it-tests</module>
            </modules>
        </profile>

        <profile>
            <id>security</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.5.1</version>
                        <executions>
                            <execution>
                                <id>copy-dependencies</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/lib/</outputDirectory>
                                    <includeScope>runtime</includeScope>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
        <repository>
            <id>mulesoft-snapshots</id>
            <name>MuleSoft Snapshots Repository</name>
            <url>http://repository.mulesoft.org/snapshots/</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Releases Repository</name>
            <url>http://repository.mulesoft.org/releases/</url>
            <layout>default</layout>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>mulesoft-snapshots</id>
            <name>MuleSoft Snapshots Repository</name>
            <url>http://repository.mulesoft.org/snapshots/</url>
            <layout>default</layout>
        </pluginRepository>
        <pluginRepository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Releases Repository</name>
            <url>http://repository.mulesoft.org/releases/</url>
            <layout>default</layout>
        </pluginRepository>
    </pluginRepositories>

    <scm>
        <connection>scm:git:git://github.com:mulesoft/apikit.git</connection>
        <developerConnection>scm:git:git@github.com:mulesoft/apikit.git</developerConnection>
        <url>http://github.com/mulesoft/apikit</url>
        <tag>HEAD</tag>
    </scm>

</project>
