<?xml version="1.0"?>
<!--

    Copyright (C) 2006-2019 INRIA and contributors

    Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of the Cecill-C License (see LICENSE-CECILL-C.txt).
    You as the user are entitled to choose the terms under which to adopt Spoon.

-->
<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>fr.inria.gforge.spoon</groupId>
    <artifactId>spoon-pom</artifactId>
    <version>1.0</version>
    <relativePath>spoon-pom</relativePath>
  </parent>
  <artifactId>spoon-core</artifactId>
  <packaging>jar</packaging>
  <version>9.1.0</version>
  <name>Spoon Core</name>
  <description>eccfec9ee3fd529c37d8dcb9f762a7bd17e41fb3</description>
  <url>http://spoon.gforge.inria.fr/</url>
  <licenses>
    <license>
      <name>CeCILL-C</name>
      <comments>French equivalent to LGPL</comments>
      <url>https://cecill.info/licences/Licence_CeCILL-C_V1-en.txt</url>
      <distribution>repo</distribution>
    </license>
    <license>
      <name>MIT</name>
      <url>https://opensource.org/licenses/MIT</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <properties>
    <java.src.version>1.8</java.src.version>
    <sonar.coverage.exclusions>
        **/support/gui/*
    </sonar.coverage.exclusions>
    <checkstyle.config.location>checkstyle.xml</checkstyle.config.location>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.eclipse.jdt</groupId>
      <artifactId>org.eclipse.jdt.core</artifactId>
      <version>3.26.0</version>
      <exclusions>
        <exclusion>
          <groupId>org.eclipse.platform</groupId>
          <artifactId>org.eclipse.core.resources</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.eclipse.platform</groupId>
          <artifactId>org.eclipse.core.runtime</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.eclipse.platform</groupId>
          <artifactId>org.eclipse.core.filesystem</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.eclipse.platform</groupId>
          <artifactId>org.eclipse.text</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.martiansoftware</groupId>
      <artifactId>jsap</artifactId>
      <version>2.1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.32</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.11.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-model</artifactId>
      <version>3.8.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.12.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.tukaani/xz -->
    <dependency>
      <groupId>org.tukaani</groupId>
      <artifactId>xz</artifactId>
      <version>1.9</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.12.4</version>
    </dependency>
    <dependency>
      <!-- support for compressed serialized ASTs -->
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-compress</artifactId>
      <version>1.21</version>
    </dependency>
    <dependency>
      <!-- to reproduce JTD error with nullable annotation -->
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>30.1.1-jre</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.2.5</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <!-- to reproduce and fix a bug -->
      <groupId>com.mysema.querydsl</groupId>
      <artifactId>querydsl-core</artifactId>
      <version>3.6.9</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>com.google.code.findbugs</groupId>
          <artifactId>jsr305</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.mysema.commons</groupId>
          <artifactId>mysema-commons-lang</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.infradna.tool</groupId>
          <artifactId>bridge-method-annotation</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.shared</groupId>
      <artifactId>maven-invoker</artifactId>
      <version>3.1.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>2.0.1.Final</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>2.8.8</version>
      <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/uk.org.lidalia/slf4j-test -->
    <dependency>
      <groupId>uk.org.lidalia</groupId>
      <artifactId>slf4j-test</artifactId>
      <version>1.2.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.7</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
          <execution>
            <!-- reference:
                  * https://www.jacoco.org/jacoco/trunk/doc/check-mojo.html
                  * https://stackoverflow.com/questions/41891739/how-to-fail-a-maven-build-if-junit-coverage-falls-below-certain-threshold
                  -->
            <id>check-coverage</id>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <rules>
                <rule implementation="org.jacoco.maven.RuleConfiguration">
                  <element>CLASS</element>
                  <excludes>
                    <!-- we exclude the GUI classes, because we don't have Swing GUI tests in CI -->
                    <exclude>spoon.support.gui.*</exclude>
                    <!-- we exclude the generated inner classes of ReplacementVisitor -->
                    <exclude>spoon.support.visitor.replace.ReplacementVisitor.*</exclude>
                  </excludes>
                  <limits>
                    <limit implementation="org.jacoco.report.check.Limit">
                      <counter>LINE</counter>
                      <value>COVEREDRATIO</value>
                      <minimum>0.1</minimum>
                    </limit>
                  </limits>
                </rule>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <archive>
            <manifest>
              <mainClass>spoon.Launcher</mainClass>
            </manifest>
            <manifestEntries>
              <Multi-Release>true</Multi-Release>
            </manifestEntries>
          </archive>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
            <!-- descriptorRef>project</descriptorRef -->
          </descriptorRefs>
          <!-- descriptor>src/main/assembly/project.xml</descriptor -->
        </configuration>
        <executions>
          <execution>
            <id>make-assembly</id>
            <!-- this is used for inheritance merges -->
            <phase>package</phase>
            <!-- append to the packaging phase. -->
            <goals>
              <goal>attached</goal>
              <!-- goals == mojos -->
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>3.1.2</version>
        <configuration>
          <failsOnError>true</failsOnError>
          <consoleOutput>true</consoleOutput>
          <!-- we exclude the generated files, see CtGenerationTest -->
          <excludes>spoon/support/visitor/clone/CloneBuilder.java</excludes>
          <excludes>spoon/reflect/visitor/CtBiScannerDefault.java</excludes>
          <excludes>spoon/support/visitor/equals/EqualsVisitor.java</excludes>
          <excludes>spoon/support/visitor/replace/ReplacementVisitor.java</excludes>
        </configuration>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>checkstyle</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M5</version>
        <configuration>
          <classpathDependencyExcludes>
            <classpathDependencyExclude>ch.qos.logback:logback-classic</classpathDependencyExclude>
          </classpathDependencyExcludes>
        </configuration>
      </plugin>
      <plugin>
        <!-- see https://github.com/castor-software/depclean -->
        <groupId>se.kth.castor</groupId>
        <artifactId>depclean-maven-plugin</artifactId>
        <version>2.0.1</version>
        <executions>
          <execution>
            <goals>
              <goal>depclean</goal>
            </goals>
            <configuration>
              <!-- the build fails if there are unused direct dependencies -->
              <failIfUnusedDirect>true</failIfUnusedDirect>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
