<?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>

  <parent>
    <groupId>org.sonarsource.xml</groupId>
    <artifactId>xml</artifactId>
    <version>2.15.0.7513</version>
  </parent>

  <artifactId>sonar-xml-plugin</artifactId>
  <packaging>sonar-plugin</packaging>

  <name>SonarSource XML Analyzer Plugin</name>
  <!-- Be careful when altering <description> as its value shows up in the SonarQube GUI -->
  <description>Code Analyzer for XML</description>
  <url>http://redirect.sonarsource.com/plugins/xml.html</url>

  <scm>
    <connection>scm:git:git@github.com:SonarSource/sonar-xml.git</connection>
    <developerConnection>scm:git:git@github.com:SonarSource/sonar-xml.git</developerConnection>
    <url>https://github.com/SonarSource/sonar-xml</url>
    <tag>HEAD</tag>
  </scm>

  <dependencies>
    <dependency>
      <groupId>org.sonarsource.analyzer-commons</groupId>
      <artifactId>sonar-analyzer-commons</artifactId>
    </dependency>

    <dependency>
      <groupId>org.sonarsource.api.plugin</groupId>
      <artifactId>sonar-plugin-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.sonarsource.api.plugin</groupId>
        <artifactId>sonar-plugin-api-test-fixtures</artifactId>
        <scope>test</scope>
      </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.sonarsource.analyzer-commons</groupId>
      <artifactId>sonar-xml-parsing</artifactId>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-migrationsupport</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.analyzer-commons</groupId>
      <artifactId>sonar-analyzer-test-commons</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.analyzer-commons</groupId>
      <artifactId>test-sonar-xml-parsing</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.sonarqube</groupId>
      <artifactId>sonar-plugin-api-impl</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
        <artifactId>sonar-packaging-maven-plugin</artifactId>
        <configuration>
          <pluginName>XML Code Quality and Security</pluginName>
          <pluginClass>org.sonar.plugins.xml.XmlPlugin</pluginClass>
          <skipDependenciesPackaging>true</skipDependenciesPackaging>
          <sonarLintSupported>true</sonarLintSupported>
          <pluginApiMinVersion>${sonar.pluginApi.minVersion}</pluginApiMinVersion>
          <requiredForLanguages>xml</requiredForLanguages>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>false</shadedArtifactAttached>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <minimizeJar>true</minimizeJar>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/LICENSE*</exclude>
                    <exclude>META-INF/NOTICE*</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/services/*</exclude>
                    <exclude>LICENSE*</exclude>
                    <exclude>NOTICE*</exclude>
                  </excludes>
                </filter>
                <filter>
                  <artifact>xerces:xercesImpl</artifact>
                  <includes>
                    <include>**</include>
                  </includes>
                </filter>
                <filter>
                  <artifact>xml-apis:xml-apis</artifact>
                  <includes>
                    <include>**</include>
                  </includes>
                </filter>
              </filters>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-plugin-size</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <phase>verify</phase>
            <configuration>
              <rules>
                <requireFilesSize>
                  <maxsize>2680000</maxsize>
                  <minsize>2630000</minsize>
                  <files>
                    <file>${project.build.directory}/${project.build.finalName}.jar</file>
                  </files>
                </requireFilesSize>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
