<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-maven-plugins</artifactId>
    <version>1.42.0</version>
    <packaging>pom</packaging>
    <name>Maven Plugins for Azure</name>
    <description>Maven plugins for Microsoft Azure services</description>
    <url>https://github.com/microsoft/azure-maven-plugins</url>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:https://github.com/microsoft/azure-maven-plugins</connection>
        <developerConnection>scm:git:git@github.com:microsoft/azure-maven-plugins</developerConnection>
        <url>https://github.com/microsoft/azure-maven-plugins</url>
        <tag>HEAD</tag>
    </scm>

    <developers>
        <developer>
            <id>xscript</id>
            <name>Kevin Zhao</name>
            <email>kevinzha@microsoft.com</email>
        </developer>
    </developers>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <name>Sonatype Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <uniqueVersion>true</uniqueVersion>
            <layout>default</layout>
        </snapshotRepository>
    </distributionManagement>

    <modules>
        <module>build-tools</module>
        <module>azure-toolkit-libs</module>
        <module>azure-maven-plugin-lib</module>
        <module>azure-webapp-maven-plugin</module>
        <module>azure-functions-maven-plugin</module>
        <module>azure-sfmesh-maven-plugin</module>
        <module>azure-spring-apps-maven-plugin</module>
        <module>azure-appservice-maven-plugin-lib</module>
        <module>azure-sdk-build-tool-maven-plugin</module>
        <module>azure-container-apps-maven-plugin</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <maven.build.timestamp.format>yyyyMMddHHmmssSSS</maven.build.timestamp.format>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.version>3.8.1</maven.version>
        <maven-plugin-tools.version>3.11.0</maven-plugin-tools.version>
        <maven-plugin-plugin.version>3.11.0</maven-plugin-plugin.version>
        <maven.filtering.version>3.3.1</maven.filtering.version>
        <maven.plugin-testing-harness.version>3.3.0</maven.plugin-testing-harness.version>
        <azure.maven-plugin-lib.version>1.42.0</azure.maven-plugin-lib.version>
        <jacoco.version>0.8.8</jacoco.version>

        <maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
        <aspectj-maven-plugin.version>1.14.0</aspectj-maven-plugin.version>

        <aspectj.version>1.9.20.1</aspectj.version>
        <json.schema-validator.version>1.0.56</json.schema-validator.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.microsoft.azure</groupId>
                <artifactId>azure-toolkit-libs</artifactId>
                <version>0.53.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven</artifactId>
                <version>${maven.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.maven.plugin-tools</groupId>
                <artifactId>maven-plugin-tools</artifactId>
                <version>${maven-plugin-tools.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- manage dependencies only related to maven plugin -->
            <dependency>
                <groupId>com.microsoft.azure</groupId>
                <artifactId>azure-maven-plugin-lib</artifactId>
                <version>${azure.maven-plugin-lib.version}</version>
            </dependency>
            <dependency>
                <groupId>com.microsoft.azure</groupId>
                <artifactId>azure-appservice-maven-plugin-lib</artifactId>
                <version>${azure.maven-plugin-lib.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven.shared</groupId>
                <artifactId>maven-filtering</artifactId>
                <version>${maven.filtering.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven.plugin-testing</groupId>
                <artifactId>maven-plugin-testing-harness</artifactId>
                <version>${maven.plugin-testing-harness.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.jacoco</groupId>
                <artifactId>org.jacoco.agent</artifactId>
                <version>${jacoco.version}</version>
                <classifier>runtime</classifier>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <!-- lock down plugins versions to avoid using Maven defaults (may be
                moved to parent pom) -->
            <plugins>
                <plugin>
                    <!--https://www.baeldung.com/maven-plugin-override-parent-->
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>aspectj-maven-plugin</artifactId>
                    <version>${aspectj-maven-plugin.version}</version>
                    <configuration>
                        <showWeaveInfo>false</showWeaveInfo>
                        <source>1.8</source>
                        <target>1.8</target>
                        <Xlint>ignore</Xlint>
                        <complianceLevel>1.8</complianceLevel>
                        <encoding>UTF-8</encoding>
                        <verbose>false</verbose>
                        <outxml>true</outxml>
                        <forceAjcCompile>true</forceAjcCompile>
                        <sources/><!-- this is important!-->
                        <aspectLibraries>
                            <aspectLibrary>
                                <groupId>com.microsoft.azure</groupId>
                                <artifactId>azure-toolkit-common-lib</artifactId>
                            </aspectLibrary>
                        </aspectLibraries>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.aspectj</groupId>
                            <artifactId>aspectjrt</artifactId>
                            <version>${aspectj.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>compile-with-aspectj</id>
                            <phase>process-classes</phase>
                            <configuration>
                                <weaveDirectories>
                                    <weaveDirectory>${project.build.directory}/classes</weaveDirectory>
                                </weaveDirectories>
                            </configuration>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>test-compile-with-aspectj</id>
                            <phase>process-test-classes</phase>
                            <configuration>
                                <weaveDirectories>
                                    <weaveDirectory>${project.build.directory}/test-classes</weaveDirectory>
                                </weaveDirectories>
                            </configuration>
                            <goals>
                                <goal>test-compile</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.9.1</version>
                    <configuration>
                        <!-- Inject the property into the skip tag -->
<!--                        <skip>true</skip>-->
                        <show>private</show>
                        <failOnError>false</failOnError>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.2.1</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <systemPropertyVariables>
                            <jacoco-agent.destfile>${project.build.directory}/coverage.exec</jacoco-agent.destfile>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>${maven-plugin-plugin.version}</version>
                    <configuration>
                        <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                    </configuration>
                    <executions>
                        <execution>
                            <id>mojo-descriptor</id>
                            <goals>
                                <goal>descriptor</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>help-goal</id>
                            <goals>
                                <goal>helpmojo</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.microsoft.azure</groupId>
                            <artifactId>maven-plugins-build-tools</artifactId>
                            <version>1.42.0</version>
                        </dependency>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>8.43</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <configLocation>checkstyle/checkstyle.xml</configLocation>
                        <suppressionsLocation>checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
                        <headerLocation>checkstyle/java.header</headerLocation>
                        <encoding>UTF-8</encoding>
                        <consoleOutput>true</consoleOutput>
                        <failsOnError>true</failsOnError>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <linkXRef>false</linkXRef>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-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-javadoc-plugin</artifactId>
                <configuration>
                    <show>private</show>
                    <failOnError>false</failOnError>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
