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

<!--
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<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.xwiki.commons</groupId>
    <artifactId>xwiki-commons-tool-xar</artifactId>
    <version>9.11.7</version>
  </parent>
  <artifactId>xwiki-commons-tool-xar-plugin</artifactId>
  <name>XWiki Commons - Tools - XAR Tools - XAR Plugin</name>
  <packaging>maven-plugin</packaging>
  <description>XWiki Commons - Tools - XAR Tools - XAR Plugin</description>
  <properties>
    <xwiki.jacoco.instructionRatio>0.01</xwiki.jacoco.instructionRatio>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.dom4j</groupId>
      <artifactId>dom4j</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-archiver</artifactId>
    </dependency>
    <!-- Required by the Format mojo to write XML files -->
    <dependency>
      <artifactId>jaxen</artifactId>
      <groupId>jaxen</groupId>
      <version>1.1.6</version>
      <scope>runtime</scope>
    </dependency>
    <!-- This dependency is drawn by XOM which draws it from Jaxen. However, Jaxen 1.1.4 draws XOM 1.0 which draws
         ICU4J 2.6 which has the problem (see https://jira.xwiki.org/browse/XCOMMONS-354). The problem is fixed in
         ICU4J 2.8+ and we've chosen to use the latest version of ICU4J available. -->
    <dependency>
      <groupId>com.ibm.icu</groupId>
      <artifactId>icu4j</artifactId>
      <version>50.1.1</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-artifact</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-compat</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-model</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
    </dependency>
    <!-- Used to get access to the Maven Logger to log on the console -->
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-container-default</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.twdata.maven</groupId>
      <artifactId>mojo-executor</artifactId>
      <version>2.2.0</version>
    </dependency>
    <!-- Ensure that the Xerces version from the JDK is not used (since it's older and buggy). -->
    <dependency>
      <groupId>xerces</groupId>
      <artifactId>xercesImpl</artifactId>
    </dependency>
    <!-- Test dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <executions>
          <execution>
            <id>default-descriptor</id>
            <phase>process-classes</phase>
          </execution>
        </executions>
        <configuration>
          <!-- This to allow calling mvn xar:<mojo> from the command line. For example mvn xar:format
               Without this users would need to call mvn xwiki-commons-tool-xar-plugin:format -->
          <goalPrefix>xar</goalPrefix>
        </configuration>
      </plugin>
      <plugin>
        <!-- Note: We duplicate the configuration located in xwiki-commons-pom since commons tools use xwiki-commons
             as their parent pom and not xwiki-commons-pom. This is to avoid a circular dependency since
             xwiki-commons-pom uses the xwiki-commons-tool-validation-resources artifact. -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.xwiki.commons</groupId>
            <artifactId>xwiki-commons-tool-verification-resources</artifactId>
            <version>${project.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <!-- Used by the "blocker" execution id and the "default-cli" one
              (i.e. when executing "mvn checkstyle:check") -->
          <configLocation>checkstyle-blocker.xml</configLocation>
          <propertyExpansion>
            currentVersion=${project.version}
          </propertyExpansion>
        </configuration>
        <executions>
          <execution>
            <id>default</id>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <configLocation>checkstyle.xml</configLocation>
              <excludes>
                **/AbstractXARMojo.java,
                **/UnXARMojo.java,
                **/XARMojo.java,
                **/VerifyMojo.java,
                **/FormatMojo.java
              </excludes>
            </configuration>
          </execution>
          <execution>
            <!-- Checks that should never be excluded from executing in maven projects -->
            <id>blocker</id>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
