<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>edu.utexas.tacc.tapis</groupId>
    <artifactId>tapis-client-java</artifactId>
    <version>1.2</version>
  </parent>

  <artifactId>auth-client</artifactId>

  <name>Tapis Authenticator Client</name>
  <description>Java client for Authenticator Service</description>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>shared</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.jsonwebtoken</groupId>
      <artifactId>jjwt-impl</artifactId>
    </dependency>
    <dependency>
      <groupId>io.jsonwebtoken</groupId>
      <artifactId>jjwt-jackson</artifactId>
    </dependency>
  </dependencies>

  <build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <plugins>
      <!-- Run script to download latest auth openapi_v3.yml and generate bundled json file  -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>${exec-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>Generate bundled openapi json file</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>${basedir}/gen_spec.sh</executable>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Build generated client code using openapi-generator -->
      <plugin>
        <groupId>org.openapitools</groupId>
        <artifactId>openapi-generator-maven-plugin</artifactId>
        <version>${openapi-generator-maven-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <inputSpec>${project.basedir}/target/auth.json</inputSpec>
              <enablePostProcessFile>true</enablePostProcessFile>
              <generateAliasAsModel>true</generateAliasAsModel>
              <output>${project.build.directory}/generated-sources/openapi</output>
              <generatorName>java</generatorName>
              <groupId>edu.utexas.tacc.tapis</groupId>
              <invokerPackage>edu.utexas.tacc.tapis.auth.client.gen</invokerPackage>
              <apiPackage>edu.utexas.tacc.tapis.auth.client.gen.api</apiPackage>
              <modelPackage>edu.utexas.tacc.tapis.auth.client.gen.model</modelPackage>
              <generateApiTests>false</generateApiTests>
              <generateApiDocumentation>false</generateApiDocumentation>
              <generateModelTests>false</generateModelTests>
              <generateModelDocumentation>false</generateModelDocumentation>
              <configOptions>
                <sourceFolder>src/gen/java/main</sourceFolder>
                <dateLibrary>java8</dateLibrary>
              </configOptions>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>

    <finalName>auth-client</finalName>
  </build>

</project>
