<?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>com.github.ngeor</groupId>
    <artifactId>java</artifactId>
    <version>1.7.0</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>
  <artifactId>yak4j-swagger-maven-plugin</artifactId>
  <version>0.17.0</version>
  <packaging>maven-plugin</packaging>
  <name>yak4j-swagger-maven-plugin</name>
  <description>yak shaving for Java: A Maven plugin which processes Swagger documents</description>
  <properties>
    <!--
    plugins
    -->
    <maven-invoker-plugin.version>3.2.1</maven-invoker-plugin.version>
    <!--
    dependencies for maven plugins
    -->
    <maven-core.version>3.6.3</maven-core.version>
    <maven-plugin-plugin.version>3.6.0</maven-plugin-plugin.version>
    <!--
    jacoco thresholds
    -->
    <jacoco.unit-tests.limit.instruction-ratio>65%</jacoco.unit-tests.limit.instruction-ratio>
    <jacoco.unit-tests.limit.branch-ratio>75%</jacoco.unit-tests.limit.branch-ratio>
    <jacoco.unit-tests.limit.class-complexity>50</jacoco.unit-tests.limit.class-complexity>
    <jacoco.unit-tests.limit.method-complexity>10</jacoco.unit-tests.limit.method-complexity>
    <jacoco.aggregate.limit.instruction-ratio>87%</jacoco.aggregate.limit.instruction-ratio>
    <jacoco.aggregate.limit.branch-ratio>82%</jacoco.aggregate.limit.branch-ratio>
    <jacoco.aggregate.limit.class-complexity>50</jacoco.aggregate.limit.class-complexity>
    <jacoco.aggregate.limit.method-complexity>10</jacoco.aggregate.limit.method-complexity>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-yaml</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>${maven-core.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>${maven-core.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-artifact</artifactId>
      <version>${maven-core.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>${maven-plugin-plugin.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <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>
      </plugin>
      <plugin>
        <groupId>org.eluder.coveralls</groupId>
        <artifactId>coveralls-maven-plugin</artifactId>
      </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>
        <configuration>
          <excludes>**/HelpMojo.*</excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-invoker-plugin</artifactId>
        <version>${maven-invoker-plugin.version}</version>
        <configuration>
          <debug>true</debug>
          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
          <postBuildHookScript>verify</postBuildHookScript>
          <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
          <settingsFile>src/it/settings.xml</settingsFile>
          <goals>
            <goal>clean</goal>
            <goal>compile</goal>
          </goals>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>install</goal>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <configuration>
          <excludes>
            <!-- generated file -->
            <exclude>com/github/ngeor/yak4j/HelpMojo.class</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <id>pre-unit-test</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>post-unit-test</id>
            <goals>
              <goal>report</goal>
            </goals>
            <phase>test</phase>
          </execution>
          <execution>
            <id>check-unit-test</id>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>test</phase>
            <configuration>
              <rules>
                <rule>
                  <element>BUNDLE</element>
                  <limits>
                    <limit>
                      <counter>INSTRUCTION</counter>
                      <value>COVEREDRATIO</value>
                      <minimum>${jacoco.unit-tests.limit.instruction-ratio}</minimum>
                    </limit>
                    <limit>
                      <counter>BRANCH</counter>
                      <value>COVEREDRATIO</value>
                      <minimum>${jacoco.unit-tests.limit.branch-ratio}</minimum>
                    </limit>
                  </limits>
                </rule>
                <rule>
                  <element>CLASS</element>
                  <limits>
                    <limit>
                      <counter>COMPLEXITY</counter>
                      <value>TOTALCOUNT</value>
                      <maximum>${jacoco.unit-tests.limit.class-complexity}</maximum>
                    </limit>
                  </limits>
                </rule>
                <rule>
                  <element>METHOD</element>
                  <limits>
                    <limit>
                      <counter>COMPLEXITY</counter>
                      <value>TOTALCOUNT</value>
                      <maximum>${jacoco.unit-tests.limit.method-complexity}</maximum>
                    </limit>
                  </limits>
                </rule>
              </rules>
            </configuration>
          </execution>
          <execution>
            <id>pre-integration-test</id>
            <goals>
              <goal>prepare-agent-integration</goal>
            </goals>
            <configuration>
              <propertyName>invoker.mavenOpts</propertyName>
            </configuration>
          </execution>
          <execution>
            <id>post-integration-test</id>
            <goals>
              <goal>report-integration</goal>
            </goals>
          </execution>
          <execution>
            <id>merge-results</id>
            <goals>
              <goal>merge</goal>
            </goals>
            <phase>verify</phase>
            <configuration>
              <fileSets>
                <fileSet>
                  <directory>${project.build.directory}</directory>
                  <includes>
                    <include>*.exec</include>
                  </includes>
                  <excludes>
                    <exclude>aggregate.exec</exclude>
                  </excludes>
                </fileSet>
              </fileSets>
              <destFile>${project.build.directory}/aggregate.exec</destFile>
            </configuration>
          </execution>
          <execution>
            <id>post-merge-report</id>
            <goals>
              <goal>report</goal>
            </goals>
            <phase>verify</phase>
            <configuration>
              <dataFile>${project.build.directory}/aggregate.exec</dataFile>
              <outputDirectory>${project.reporting.outputDirectory}/jacoco-aggregate</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>check-aggregate</id>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>verify</phase>
            <configuration>
              <dataFile>${project.build.directory}/aggregate.exec</dataFile>
              <rules>
                <rule>
                  <element>BUNDLE</element>
                  <limits>
                    <limit>
                      <counter>INSTRUCTION</counter>
                      <value>COVEREDRATIO</value>
                      <minimum>${jacoco.aggregate.limit.instruction-ratio}</minimum>
                    </limit>
                    <limit>
                      <counter>BRANCH</counter>
                      <value>COVEREDRATIO</value>
                      <minimum>${jacoco.aggregate.limit.branch-ratio}</minimum>
                    </limit>
                  </limits>
                </rule>
                <rule>
                  <element>CLASS</element>
                  <limits>
                    <limit>
                      <counter>COMPLEXITY</counter>
                      <value>TOTALCOUNT</value>
                      <maximum>${jacoco.aggregate.limit.class-complexity}</maximum>
                    </limit>
                  </limits>
                </rule>
                <rule>
                  <element>METHOD</element>
                  <limits>
                    <limit>
                      <counter>COMPLEXITY</counter>
                      <value>TOTALCOUNT</value>
                      <maximum>${jacoco.aggregate.limit.method-complexity}</maximum>
                    </limit>
                  </limits>
                </rule>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
