<?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>sonia.scm</groupId>
    <artifactId>scm</artifactId>
    <version>2.0.0-SNAPSHOT</version>
  </parent>

  <groupId>sonia.scm.plugins</groupId>
  <artifactId>scm-plugins</artifactId>
  <packaging>pom</packaging>
  <version>2.0.0-SNAPSHOT</version>
  <name>scm-plugins</name>

  <modules>
    <module>scm-hg-plugin</module>
    <module>scm-git-plugin</module>
    <module>scm-svn-plugin</module>
    <module>scm-legacy-plugin</module>
  </modules>

  <dependencies>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>${servlet.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>sonia.scm</groupId>
      <artifactId>scm-core</artifactId>
      <version>2.0.0-SNAPSHOT</version>
      <scope>provided</scope>
    </dependency>

    <!-- annotation processors -->

    <dependency>
      <groupId>sonia.scm</groupId>
      <artifactId>scm-annotation-processor</artifactId>
      <version>2.0.0-SNAPSHOT</version>
      <scope>provided</scope>
    </dependency>

    <!-- Annotation processor for DTO mappers-->
    <dependency>
      <groupId>org.mapstruct</groupId>
      <artifactId>mapstruct-processor</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- Annotation processor for getter, setters, constructors, etc. -->
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- test scope -->

    <dependency>
      <groupId>sonia.scm</groupId>
      <artifactId>scm-test</artifactId>
      <version>2.0.0-SNAPSHOT</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxrs</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jackson2-provider</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <resources>

      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>META-INF/scm/plugin.xml</include>
          <include>sonia/scm/version/*</include>
        </includes>
      </resource>

      <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
        <excludes>
          <exclude>META-INF/scm/plugin.xml</exclude>
          <exclude>sonia/scm/version/*</exclude>
        </excludes>
      </resource>

    </resources>

    <plugins>

      <plugin>
        <groupId>sonia.scm.maven</groupId>
        <artifactId>smp-maven-plugin</artifactId>
        <extensions>true</extensions>
      </plugin>

    <plugin>
      <groupId>com.github.sdorra</groupId>
      <artifactId>buildfrontend-maven-plugin</artifactId>
      <configuration>
        <node>
          <version>${nodejs.version}</version>
        </node>
        <pkgManager>
          <type>YARN</type>
          <version>${yarn.version}</version>
        </pkgManager>
        <failOnMissingPackageJson>false</failOnMissingPackageJson>
      </configuration>
    </plugin>

    </plugins>
  </build>

  <profiles>
    <profile>
      <id>plugin-doc</id>

      <build>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-enunciate-configuration</id>
                <phase>compile</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                  <resources>
                    <resource>
                      <directory>src/main/doc</directory>
                      <filtering>true</filtering>
                      <includes>
                        <include>**/enunciate.xml</include>
                      </includes>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>com.webcohesion.enunciate</groupId>
            <artifactId>enunciate-maven-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>docs</goal>
                </goals>
                <phase>compile</phase>
              </execution>
            </executions>
            <configuration>
              <configFile>${project.build.directory}/enunciate.xml</configFile>
              <docsDir>${project.build.directory}</docsDir>
              <docsSubdir>restdocs</docsSubdir>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>com.webcohesion.enunciate</groupId>
                <artifactId>enunciate-top</artifactId>
                <version>${enunciate.version}</version>
                <exclusions>
                  <exclusion>
                    <groupId>com.webcohesion.enunciate</groupId>
                    <artifactId>enunciate-swagger</artifactId>
                  </exclusion>
                </exclusions>
              </dependency>
              <dependency>
                <groupId>com.webcohesion.enunciate</groupId>
                <artifactId>enunciate-lombok</artifactId>
                <version>${enunciate.version}</version>
              </dependency>
            </dependencies>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
              <descriptors>
                <descriptor>src/main/doc/assembly.xml</descriptor>
              </descriptors>
            </configuration>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>

  </profiles>

</project>
