<?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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.alfresco</groupId>
    <artifactId>alfresco-acs-java-rest-api</artifactId>
    <version>6.3.0-A4</version>
  </parent>

  <artifactId>alfresco-acs-java-rest-api-lib</artifactId>
  <name>Alfresco Java Rest API :: Rest Clients</name>
  <packaging>pom</packaging>

  <properties>
    <project.build.generatedSourceDirectory>generated</project.build.generatedSourceDirectory>
    <swagger-codegen-maven-plugin.groupId>io.swagger</swagger-codegen-maven-plugin.groupId>
    <swagger-codegen-maven-plugin.version>2.4.30</swagger-codegen-maven-plugin.version>
    <exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>
    <!-- Base Paths -->
    <acs.version>23.2.0</acs.version>
    <ags.version>23.2.0.63</ags.version>
    <!-- API definitions -->
    <acs.core.api>${project.build.directory}/definitions/alfresco-core.yaml</acs.core.api>
    <acs.auth.api>${project.build.directory}/definitions/alfresco-auth.yaml</acs.auth.api>
    <acs.discovery.api>${project.build.directory}/definitions/alfresco-discovery.yaml</acs.discovery.api>
    <acs.governance-core.api>${project.build.directory}/definitions/gs-core-api.yaml</acs.governance-core.api>
    <acs.governance-classification.api>${project.build.directory}/definitions/gs-classification-api.yaml</acs.governance-classification.api>
    <acs.model.api>${project.build.directory}/definitions/alfresco-model.yaml</acs.model.api>
    <acs.search.api>${project.build.directory}/definitions/alfresco-search.yaml</acs.search.api>
    <acs.search-sql.api>${project.build.directory}/definitions/alfresco-search-sql.yaml</acs.search-sql.api>
  </properties>
  <modules>
    <module>${project.build.generatedSourceDirectory}/alfresco-core-rest-api</module>
    <module>${project.build.generatedSourceDirectory}/alfresco-auth-rest-api</module>
    <module>${project.build.generatedSourceDirectory}/alfresco-discovery-rest-api</module>
    <module>${project.build.generatedSourceDirectory}/alfresco-governance-core-rest-api</module>
    <module>${project.build.generatedSourceDirectory}/alfresco-governance-classification-rest-api</module>
    <module>${project.build.generatedSourceDirectory}/alfresco-model-rest-api</module>
    <module>${project.build.generatedSourceDirectory}/alfresco-search-rest-api</module>
    <module>${project.build.generatedSourceDirectory}/alfresco-search-sql-rest-api</module>
    <module>alfresco-event-gateway-api-client</module>
  </modules>
  <repositories>
    <repository>
      <id>alfresco-public</id>
      <url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
    </repository>
    <repository>
      <id>alfresco-private</id>
      <url>https://artifacts.alfresco.com/nexus/content/groups/private</url>
    </repository>
  </repositories>
  <profiles>
    <profile>
      <id>generate</id>
      <activation>
        <property>
          <name>!skip.generation</name>
        </property>
      </activation>
      <build>
        <resources>
          <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
          </resource>
        </resources>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <inherited>false</inherited>
            <configuration>
              <filesets>
                <fileset>
                  <directory>generated</directory>
                </fileset>
              </filesets>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>copy-acs-api-definitions</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                  <artifactItems>
                    <artifactItem>
                      <groupId>org.alfresco</groupId>
                      <artifactId>api-explorer</artifactId>
                      <version>${acs.version}</version>
                      <type>war</type>
                      <includes>**/*.yaml</includes>
                    </artifactItem>
                    <artifactItem>
                      <groupId>org.alfresco</groupId>
                      <artifactId>alfresco-governance-services-enterprise-rest-api-explorer</artifactId>
                      <version>${ags.version}</version>
                      <type>war</type>
                      <includes>**/*.yaml</includes>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>process-templates</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>resources</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>${swagger-codegen-maven-plugin.groupId}</groupId>
            <artifactId>swagger-codegen-maven-plugin</artifactId>
            <version>${swagger-codegen-maven-plugin.version}</version>
            <inherited>false</inherited>
            <configuration>
              <groupId>${project.groupId}</groupId>
              <artifactVersion>${project.version}</artifactVersion>
              <language>spring</language>
              <library>spring-cloud</library>
              <templateDirectory>${project.build.outputDirectory}/templates</templateDirectory>
              <configOptions>
                <defaultInterfaces>false</defaultInterfaces>
                <hideGenerationTimestamp>true</hideGenerationTimestamp>
                <java8>true</java8>
              </configOptions>
            </configuration>
            <executions>
              <execution>
                <id>generate-auth-api-documentation</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <language>java</language>
                  <library>resttemplate</library>
                  <inputSpec>${acs.auth.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-auth-rest-api</output>
                  <artifactId>alfresco-core-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.authentication.handler</apiPackage>
                    <modelPackage>${project.groupId}.authentication.model</modelPackage>
                    <invokerPackage>${project.groupId}</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-auth-api</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <inputSpec>${acs.auth.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-auth-rest-api</output>
                  <artifactId>alfresco-auth-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.authentication.handler</apiPackage>
                    <modelPackage>${project.groupId}.authentication.model</modelPackage>
                    <invokerPackage>${project.groupId}</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-core-api-documentation</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <language>java</language>
                  <library>resttemplate</library>
                  <inputSpec>${acs.core.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-core-rest-api</output>
                  <artifactId>alfresco-core-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.core.handler</apiPackage>
                    <modelPackage>${project.groupId}.core.model</modelPackage>
                    <invokerPackage>${project.groupId}.core</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-core-api</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <inputSpec>${acs.core.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-core-rest-api</output>
                  <artifactId>alfresco-core-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.core.handler</apiPackage>
                    <modelPackage>${project.groupId}.core.model</modelPackage>
                    <invokerPackage>${project.groupId}.core</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-discovery-rest-api-documentation</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <language>java</language>
                  <library>resttemplate</library>
                  <inputSpec>${acs.discovery.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-discovery-rest-api</output>
                  <artifactId>alfresco-discovery-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.discovery.handler</apiPackage>
                    <modelPackage>${project.groupId}.discovery.model</modelPackage>
                    <invokerPackage>${project.groupId}</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-discovery-rest-api</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <inputSpec>${acs.discovery.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-discovery-rest-api</output>
                  <artifactId>alfresco-discovery-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.discovery.handler</apiPackage>
                    <modelPackage>${project.groupId}.discovery.model</modelPackage>
                    <invokerPackage>${project.groupId}</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-governance-core-rest-api-documentation</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <language>java</language>
                  <library>resttemplate</library>
                  <inputSpec>${acs.governance-core.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-governance-core-rest-api</output>
                  <artifactId>alfresco-governance-core-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.governance.core.handler</apiPackage>
                    <modelPackage>${project.groupId}.governance.core.model</modelPackage>
                    <invokerPackage>${project.groupId}</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-governance-core-rest-api</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <inputSpec>${acs.governance-core.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-governance-core-rest-api</output>
                  <artifactId>alfresco-governance-core-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.governance.core.handler</apiPackage>
                    <modelPackage>${project.groupId}.governance.core.model</modelPackage>
                    <invokerPackage>${project.groupId}</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-governance-classification-rest-api-documentation</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <language>java</language>
                  <library>resttemplate</library>
                  <inputSpec>${acs.governance-classification.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-governance-classification-rest-api</output>
                  <artifactId>alfresco-governance-classification-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.governance.classification.handler</apiPackage>
                    <modelPackage>${project.groupId}.governance.classification.model</modelPackage>
                    <invokerPackage>${project.groupId}</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-governance-classification-rest-api</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <inputSpec>${acs.governance-classification.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-governance-classification-rest-api</output>
                  <artifactId>alfresco-governance-classification-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.governance.classification.handler</apiPackage>
                    <modelPackage>${project.groupId}.governance.classification.model</modelPackage>
                    <invokerPackage>${project.groupId}</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-model-api-documentation</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <language>java</language>
                  <library>resttemplate</library>
                  <inputSpec>${acs.model.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-model-rest-api</output>
                  <artifactId>alfresco-model-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.model.handler</apiPackage>
                    <modelPackage>${project.groupId}.model.model</modelPackage>
                    <invokerPackage>${project.groupId}.model</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-model-api</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <inputSpec>${acs.model.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-model-rest-api</output>
                  <artifactId>alfresco-model-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.model.handler</apiPackage>
                    <modelPackage>${project.groupId}.model.model</modelPackage>
                    <invokerPackage>${project.groupId}.model</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-search-rest-api-documentation</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <language>java</language>
                  <library>resttemplate</library>
                  <inputSpec>${acs.search.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-search-rest-api</output>
                  <artifactId>alfresco-search-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.search.handler</apiPackage>
                    <modelPackage>${project.groupId}.search.model</modelPackage>
                    <invokerPackage>${project.groupId}</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-search-rest-api</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <inputSpec>${acs.search.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-search-rest-api</output>
                  <artifactId>alfresco-search-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.search.handler</apiPackage>
                    <modelPackage>${project.groupId}.search.model</modelPackage>
                    <invokerPackage>${project.groupId}</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-search-sql-rest-api-documentation</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <language>java</language>
                  <library>resttemplate</library>
                  <inputSpec>${acs.search-sql.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-search-sql-rest-api</output>
                  <artifactId>alfresco-search-sql-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.search.sql.handler</apiPackage>
                    <modelPackage>${project.groupId}.search.sql.model</modelPackage>
                    <invokerPackage>${project.groupId}</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
              <execution>
                <id>generate-search-sql-rest-api</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <inputSpec>${acs.search-sql.api}</inputSpec>
                  <output>${project.build.generatedSourceDirectory}/alfresco-search-sql-rest-api</output>
                  <artifactId>alfresco-search-sql-rest-api</artifactId>
                  <configOptions>
                    <apiPackage>${project.groupId}.search.sql.handler</apiPackage>
                    <modelPackage>${project.groupId}.search.sql.model</modelPackage>
                    <invokerPackage>${project.groupId}</invokerPackage>
                  </configOptions>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>${exec-maven-plugin.version}</version>
            <inherited>false</inherited>
            <executions>
              <execution>
                <phase>generate-sources</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>bash</executable>
                  <arguments>
                    <argument>patch.sh</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>add-license-header</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>format</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>validate-license</id>
                <phase>process-sources</phase>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>swagger3</id>
      <properties>
        <swagger-codegen-maven-plugin.groupId>io.swagger.codegen.v3</swagger-codegen-maven-plugin.groupId>
        <swagger-codegen-maven-plugin.version>3.0.36</swagger-codegen-maven-plugin.version>
      </properties>
    </profile>
    <profile>
      <id>jdk9+</id>
      <activation>
        <jdk>[9,)</jdk>
      </activation>
      <properties>
        <maven.compiler.release>${java.release}</maven.compiler.release>
      </properties>
    </profile>
  </profiles>

</project>
