<?xml version="1.0" encoding="UTF-8"?>
<!--

  ~ Copyright (C) 2020-2024 Huawei Technologies Co., Ltd. All rights reserved.

  ~ 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://maven.apache.org/POM/4.0.0"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-build</artifactId>
    <!-- This version should match spring-cloud-dependencies 'spring-cloud-build.version' -->
    <version>4.0.2</version>
  </parent>

  <groupId>com.huaweicloud</groupId>
  <artifactId>spring-cloud-huawei</artifactId>
  <version>1.11.11-2024.0.x</version>
  <packaging>pom</packaging>
  <name>Spring Cloud Huawei</name>

  <properties>
    <!-- spring-cloud-dependencies do not import spring-boot-dependencies, spring-boot-dependencies
     import spring-framework-bom. No need configure spring version. -->
    <spring-cloud.version>2024.0.1</spring-cloud.version>
    <spring-boot.version>3.4.4</spring-boot.version>
    <servicecomb.version>2.8.24</servicecomb.version>
  </properties>

  <modules>
    <!-- modules sorted by logic dependency -->
    <module>spring-cloud-huawei-bom</module>
    <module>spring-cloud-huawei-dependencies</module>
    <module>spring-cloud-huawei-parents</module>
    <module>spring-cloud-huawei-common</module>
    <module>spring-cloud-huawei-governance</module>
    <module>spring-cloud-huawei-router</module>
    <module>spring-cloud-huawei-swagger</module>
    <module>spring-cloud-huawei-service-engine</module>
    <module>spring-cloud-huawei-mesh</module>
    <module>spring-cloud-huawei-nacos</module>
    <module>spring-cloud-starter-huawei</module>
  </modules>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <url>https://github.com/huaweicloud/spring-cloud-huawei</url>
    <connection>scm:git:git://github.com/huaweicloud/spring-cloud-huawei.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/huaweicloud/spring-cloud-huawei.git
    </developerConnection>
    <tag>HEAD</tag>
  </scm>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <distributionManagement>
        <snapshotRepository>
          <id>oss</id>
          <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
          <id>oss</id>
          <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
      </distributionManagement>
    </profile>
    <profile>
      <id>it</id>
      <modules>
        <module>integration-tests</module>
        <module>coverage-reports</module>
      </modules>
    </profile>
  </profiles>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <version>3.16.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <version>0.13</version>
        <configuration>
          <excludes>
            <exclude>DISCLAIMER</exclude>
            <exclude>.travis.yml</exclude>
            <exclude>**/cert_pwd</exclude>
            <exclude>**/*.cer</exclude>
            <exclude>**/*.md</exclude>
            <excldue>**/*.MD</excldue>
            <excldue>**/*.iml</excldue>
            <excldue>.github/**</excldue>
            <!-- Skip the code style configuration file -->
            <exclude>**/etc/eclipse-java-google-style.xml</exclude>
            <exclude>**/etc/intellij-java-google-style.xml</exclude>
            <!-- Skip the ssl configuration files -->
            <exculde>**/resources/ssl/**</exculde>
            <!-- SKip the licenses files -->
            <exclude>**/src/release/licenses/**</exclude>
            <!-- Skip the demo log files -->
            <exclude>**/logs/**.log</exclude>
            <exclude>**/**.log</exclude>
            <!-- Skip the target files -->
            <exclude>**/target/**</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.16.0</version>
        <configuration>
          <rulesets>
            <!-- A rule set, that comes bundled with PMD -->
            <ruleset>pmd/rulesets/bestpractices.xml</ruleset>
          </rulesets>
          <!-- failOnViolation is actually true by default, but can be disabled -->
          <failOnViolation>true</failOnViolation>
          <!-- printFailingErrors is pretty useful -->
          <printFailingErrors>true</printFailingErrors>
          <!-- enable incremental analysis -->
          <analysisCache>false</analysisCache>
          <!--It is possible to exclude some sources from PMD check to prevent failures.-->
          <excludeFromFailureFile>pmd/violationExclusions/exclude-pmd.properties</excludeFromFailureFile>
          <excludes>
            <!--Exclude the directories you don't want to check, but it only works for sub modules. Please refer to the following example-->
            <exclude>**/com/huaweicloud/sample/**</exclude>
            <exclude>**/com/huaweicloud/samples/**</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
          <execution>
            <id>aggregate</id>
            <goals>
              <goal>aggregate-pmd</goal>
              <goal>aggregate-cpd</goal>
            </goals>
            <configuration>
              <excludeFromFailureFile>pmd/violationExclusions/exclude-pmd.properties</excludeFromFailureFile>
            </configuration>
            <phase>site</phase>
          </execution>
        </executions>
      </plugin>
      <!--SpotBugs-->
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>4.5.2.0</version>
        <dependencies>
          <!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
          <dependency>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs</artifactId>
            <version>4.5.3</version>
          </dependency>
        </dependencies>
        <configuration>
          <!--Analysis Effort-->
          <effort>Max</effort>
          <!--Minimun Condidence-->
          <threshold>Medium</threshold>
          <!--Minimum Rank-->
          <maxRank>20</maxRank>
          <!--          <includeFilterFile>spotbugs-security/spotbugs-security-include.xml</includeFilterFile>-->
          <excludeFilterFile>spotbugs-security/spotbugs-security-exclude.xml</excludeFilterFile>
          <includeTests>false</includeTests>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.16.0</version>
        <configuration>
          <rulesets>
            <ruleset>pmd/rulesets/bestpractices.xml</ruleset>
          </rulesets>
          <!-- failOnViolation is actually true by default, but can be disabled -->
          <failOnViolation>true</failOnViolation>
          <!-- printFailingErrors is pretty useful -->
          <printFailingErrors>true</printFailingErrors>
          <!-- enable incremental analysis -->
          <analysisCache>false</analysisCache>
          <excludeFromFailureFile>pmd/violationExclusions/exclude-pmd.properties</excludeFromFailureFile>
        </configuration>
        <reportSets>
          <reportSet><!-- by default, id = "default" -->
            <reports><!-- select non-aggregate reports -->
              <report>pmd</report>
              <report>cpd</report>
            </reports>
          </reportSet>
          <reportSet><!-- aggregate reportSet, to define in poms having modules -->
            <id>aggregate</id>
            <inherited>false</inherited> <!-- don't run aggregate in child modules -->
            <reports>
              <report>aggregate-pmd</report>
              <report>aggregate-cpd</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>
</project>