<?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>com.mulesoft.connectors</groupId>
    <artifactId>rest-connect-cli</artifactId>
    <version>1.0.0-alpha6</version>

    <properties>
        <formatterConfigPath>formatter.xml</formatterConfigPath>
        <javaFormatter.plugin.version>2.0.1</javaFormatter.plugin.version>
        <formatterGoal>validate</formatterGoal>

        <license.maven.plugin.version>2.11</license.maven.plugin.version>
        <mulesoftLicenseVersion>1.0.3</mulesoftLicenseVersion>
        <licensePath>LICENSE_HEADER_80.txt</licensePath>
        <licenseYear>2018</licenseYear>

        <rest.connect.aml.version>1.0.0-alpha6</rest.connect.aml.version>
        <rest.connect.version>2.0.0-alpha6</rest.connect.version>
             
        <maven.surefire.plugin.version>2.22.1</maven.surefire.plugin.version>
        <aspectjVersion>1.9.2</aspectjVersion>
        <jacoco.version>0.8.2</jacoco.version>
             
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>jar-with-dependencies</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                            <configuration>
                                <descriptorRefs>
                                    <descriptorRef>jar-with-dependencies</descriptorRef>
                                </descriptorRefs>
                                <archive>
                                    <manifest>
                                        <mainClass>org.mule.connectivity.Main</mainClass>
                                    </manifest>
                                </archive>
                            </configuration>
                        </execution>
                        <execution>
                            <id>dist</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                            <configuration>
                                <descriptors>
                                    <descriptor>src/main/resources/assembly.xml</descriptor>
                                </descriptors>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>org.mule.connectivity.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <resourceBundles>
                                <resourceBundle>com.mulesoft.restconnect:rest-connect-aml:${rest.connect.aml.version}</resourceBundle>
                            </resourceBundles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <version>${javaFormatter.plugin.version}</version>
                <configuration>
                    <compilerCompliance>${jdk.version}</compilerCompliance>
                    <compilerSource>${jdk.version}</compilerSource>
                    <compilerTargetPlatform>${jdk.version}</compilerTargetPlatform>
                    <configFile>${basedir}/${formatterConfigPath}</configFile>
                    <configJsFile>${basedir}/${formatterConfigPath}</configJsFile>
                    <aggregator>false</aggregator>
                    <executionRoot>true</executionRoot>
                    <encoding>ISO-8859-1</encoding>
                </configuration>
                <executions>
                    <execution>
                        <id>apply-format</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>${formatterGoal}</goal>
                        </goals>
                        <configuration>
                            <skipFormatting>${skipVerifications}</skipFormatting>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${license.maven.plugin.version}</version>
                <dependencies>
                    <!-- This dependency provides the license header required for the source files of this project.
                         An external artifact is used to simplify the configuration of the build as without it,
                         a cumbersome structure of relative paths per project should have been used. See EE-4843
                         for more info -->
                    <dependency>
                        <groupId>com.mulesoft.license</groupId>
                        <artifactId>license</artifactId>
                        <version>${mulesoftLicenseVersion}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <skip>${skipVerifications}</skip>
                    <header>${licensePath}</header>
                    <properties>
                        <year>${licenseYear}</year>
                    </properties>
                    <excludes>
                        <exclude>target/**</exclude>
                        <exclude>**/.gitignore</exclude>
                        <exclude>**/*.txt</exclude>
                        <exclude>**/*.groovy</exclude>
                        <exclude>**/*.sh</exclude>
                        <exclude>**/*.bat</exclude>
                        <exclude>**/*.ftl</exclude>
                        <exclude>**/*.xml</exclude>
                        <exclude>**/*.properties</exclude>
                        <exclude>**/*.sample</exclude>
                        <exclude>**/*.md</exclude>
                        <exclude>**/*.xsl</exclude>
                        <exclude>**/*.html</exclude>
                        <exclude>**/*.css</exclude>
                        <exclude>**/build-number.txt</exclude>
                    </excludes>
                    <includes>
                        <include>**/*.java</include>
                    </includes>
                    <mapping>
                        <java>SLASHSTAR_STYLE</java>
                    </mapping>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration>
                    <argLine>-Dfile.encoding=UTF-8 -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectjVersion}/aspectjweaver-${aspectjVersion}.jar -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile='${session.executionRootDirectory}/target/jacoco.exec'</argLine>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectjVersion}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.jacoco</groupId>
                        <artifactId>org.jacoco.agent</artifactId>
                        <version>${jacoco.version}</version>
                        <classifier>runtime</classifier>
                    </dependency>
                </dependencies>
            </plugin>
         </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
            <testResource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>org/mule/connectivity/rest-connect.raml</include>
                </includes>
            </testResource>
        </testResources>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.mule.connectivity</groupId>
            <artifactId>rest-connect</artifactId>
            <version>${rest.connect.version}</version>
        </dependency>
        <dependency>
            <groupId>com.beust</groupId>
            <artifactId>jcommander</artifactId>
            <version>1.72</version>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>2.23.4</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <distributionManagement>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Repository</name>
            <url>http://repository-master.mulesoft.org/releases/</url>
        </repository>
        <snapshotRepository>
            <id>mulesoft-snapshots</id>
            <name>MuleSoft Snapshot Repository</name>
            <url>http://repository-master.mulesoft.org/snapshots/</url>
            <uniqueVersion>false</uniqueVersion>
        </snapshotRepository>
    </distributionManagement>

    <scm>
        <connection>scm:git:git@github.com:mulesoft/rest-connect-aml.git</connection>
        <developerConnection>scm:git:git@github.com:mulesoft/rest-connect-aml.git</developerConnection>
        <url>https://github.com/mulesoft/rest-connect-aml</url>
    </scm>

</project>
