<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>com.ibm.research.kar</groupId>
    <artifactId>kar-java</artifactId>
    <version>0.5.1</version>
  </parent>

  <artifactId>kar-rest-client</artifactId>
  <packaging>jar</packaging>

  <name>kar-rest-client</name>
  <description>KAR Java SDK REST client</description>

  <properties>
    <version.maven-jar-plugin>3.2.0</version.maven-jar-plugin>
    <version.microprofile>3.3</version.microprofile>
    <version.cxf-rt-rs-mp-client>3.4.0</version.cxf-rt-rs-mp-client>
    <version.glassfish-json>1.1.4</version.glassfish-json>
    <version.glassfish-jaxrs>1.1.6</version.glassfish-jaxrs>
    <version.maven-compiler-plugin>3.8.1</version.maven-compiler-plugin>
    <version.java-compiler>11</version.java-compiler>
    <version.maven-help>3.2.0</version.maven-help>
    <quarkus-plugin.version>1.8.1.Final</quarkus-plugin.version>
    <quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
    <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
    <quarkus.platform.version>1.8.1.Final</quarkus.platform.version>
    <surefire-plugin.version>2.22.1</surefire-plugin.version>
    <jandex-plugin.version>1.0.8</jandex-plugin.version>
  </properties>

  <profiles>
    <profile>
      <id>openliberty</id>
      <activation>
	<property>
	  <name>!env.QUARKUS_VERSION</name>
	</property>
      </activation>
      <dependencies>
	<dependency>
	  <groupId>jakarta.platform</groupId>
	  <artifactId>jakarta.jakartaee-api</artifactId>
	  <version>8.0.0</version>
	  <scope>provided</scope>
	</dependency>
	<!-- https://mvnrepository.com/artifact/jakarta.ws.rs/jakarta.ws.rs-api -->
	<dependency>
	  <groupId>jakarta.ws.rs</groupId>
	  <artifactId>jakarta.ws.rs-api</artifactId>
	  <version>2.1.6</version>
	</dependency>
	<dependency>
	  <groupId>org.eclipse.microprofile</groupId>
	  <artifactId>microprofile</artifactId>
	  <version>${version.microprofile}</version>
	  <type>pom</type>
	  <scope>provided</scope>
	</dependency>
	<!-- Implementation of JSON APIs -->
	<dependency>
	  <groupId>org.glassfish</groupId>
	  <artifactId>javax.json</artifactId>
	  <version>${version.glassfish-json}</version>
	  <scope>provided</scope>
	</dependency>
      </dependencies>
      <build>
	<finalName>${project.artifactId}-liberty-${project.version}</finalName>
	<plugins>
	  <plugin>
	    <artifactId>maven-jar-plugin</artifactId>
	    <version>${version.maven-jar-plugin}</version>
	  </plugin>
	  <plugin>
	    <groupId>org.apache.maven.plugins</groupId>
	    <artifactId>maven-dependency-plugin</artifactId>
	    <executions>
	      <execution>
		<id>copy-dependencies</id>
		<phase>prepare-package</phase>
		<goals>
		  <goal>copy-dependencies</goal>
		</goals>
		<configuration>
		  <outputDirectory>
		    ${project.build.directory}/libs
		  </outputDirectory>
		</configuration>
	      </execution>
	    </executions>
	  </plugin>
	  <plugin>
	    <groupId>org.apache.maven.plugins</groupId>
	    <artifactId>maven-compiler-plugin</artifactId>
	    <version>${version.maven-compiler-plugin}</version>
	    <configuration>
	      <release>${version.java-compiler}</release>
	      <excludes>
		<exclude>com/ibm/research/kar/standalone/**</exclude>
	      </excludes>
	    </configuration>
	  </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
	    <configuration>
              <!-- exclude packages that are not included in this profile -->
	      <excludePackageNames>com.ibm.research.kar.standalone</excludePackageNames>
	    </configuration>
          </plugin>
	</plugins>
      </build>
    </profile>
    <profile>
      <id>standalone</id>
      <dependencies>
	<dependency>
	  <groupId>jakarta.platform</groupId>
	  <artifactId>jakarta.jakartaee-api</artifactId>
	  <version>8.0.0</version>
	  <scope>provided</scope>
	</dependency>
	<!-- https://mvnrepository.com/artifact/jakarta.ws.rs/jakarta.ws.rs-api -->
	<dependency>
	  <groupId>jakarta.ws.rs</groupId>
	  <artifactId>jakarta.ws.rs-api</artifactId>
	  <version>2.1.6</version>
	</dependency>
	<dependency>
	  <groupId>org.eclipse.microprofile</groupId>
	  <artifactId>microprofile</artifactId>
	  <version>${version.microprofile}</version>
	  <type>pom</type>
	  <scope>provided</scope>
	</dependency>
	<!-- Implementation of JSON APIs -->
	<dependency>
	  <groupId>org.glassfish</groupId>
	  <artifactId>javax.json</artifactId>
	  <version>${version.glassfish-json}</version>
	  <scope>provided</scope>
	</dependency>
	<!-- Implementation of Microprofile REST Client for standalone applications -->
	<dependency>
	  <groupId>org.apache.cxf</groupId>
	  <artifactId>cxf-rt-rs-mp-client</artifactId>
	  <version>${version.cxf-rt-rs-mp-client}</version>
	  <scope>provided</scope>
	</dependency>
	<!-- Implementation of JsonProvider for JsonValue de/serializing -->
	<dependency>
	  <groupId>org.glassfish</groupId>
	  <artifactId>jsonp-jaxrs</artifactId>
	  <version>${version.glassfish-jaxrs}</version>
	</dependency>
      </dependencies>
      <build>
	<finalName>${project.artifactId}-standalone-${project.version}</finalName>
	<plugins>
	  <plugin>
	    <artifactId>maven-jar-plugin</artifactId>
	    <version>${version.maven-jar-plugin}</version>
	  </plugin>
	  <plugin>
	    <groupId>org.apache.maven.plugins</groupId>
	    <artifactId>maven-dependency-plugin</artifactId>
	    <executions>
	      <execution>
		<id>copy-dependencies</id>
		<phase>prepare-package</phase>
		<goals>
		  <goal>copy-dependencies</goal>
		</goals>
		<configuration>
		  <outputDirectory>
		    ${project.build.directory}/libs
		  </outputDirectory>
		</configuration>
	      </execution>
	    </executions>
	  </plugin>
	  <plugin>
	    <groupId>org.apache.maven.plugins</groupId>
	    <artifactId>maven-compiler-plugin</artifactId>
	    <version>${version.maven-compiler-plugin}</version>
	    <configuration>
	      <release>${version.java-compiler}</release>
	    </configuration>
	  </plugin>
	</plugins>
      </build>
    </profile>
    <profile>
      <id>quarkus</id>
      <dependencyManagement>
	<dependencies>
	  <dependency>
	    <groupId>${quarkus.platform.group-id}</groupId>
	    <artifactId>${quarkus.platform.artifact-id}</artifactId>
	    <version>${quarkus.platform.version}</version>
	    <type>pom</type>
	    <scope>import</scope>
	  </dependency>
	</dependencies>
      </dependencyManagement>
      <dependencies>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-jsonb</artifactId>
	</dependency>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-resteasy</artifactId>
	</dependency>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-arc</artifactId>
	</dependency>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-junit5</artifactId>
	  <scope>test</scope>
	</dependency>
	<dependency>
	  <groupId>io.rest-assured</groupId>
	  <artifactId>rest-assured</artifactId>
	  <scope>test</scope>
	</dependency>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-rest-client</artifactId>
	</dependency>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-smallrye-fault-tolerance</artifactId>
	</dependency>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-rest-client-jsonb</artifactId>
	</dependency>
      </dependencies>
      <build>
	<finalName>${project.artifactId}-quarkus-${project.version}</finalName>
	<plugins>
	  <plugin>
	    <groupId>org.jboss.jandex</groupId>
	    <artifactId>jandex-maven-plugin</artifactId>
	    <version>${jandex-plugin.version}</version>
	    <executions>
	      <execution>
		<id>make-index</id>
		<goals>
		  <goal>jandex</goal>
		</goals>
	      </execution>
	    </executions>
	  </plugin>
	  <plugin>
	    <groupId>io.quarkus</groupId>
	    <artifactId>quarkus-maven-plugin</artifactId>
	    <version>${quarkus-plugin.version}</version>
	    <executions>
	      <execution>
		<goals>
		  <goal>build</goal>
		  <goal>generate-code</goal>
		  <goal>generate-code-tests</goal>
		</goals>
	      </execution>
	    </executions>
	  </plugin>
	  <plugin>
	    <artifactId>maven-compiler-plugin</artifactId>
	    <version>${version.maven-compiler-plugin}</version>
	    <configuration>
	      <release>${version.java-compiler}</release>
	      <excludes>
		<exclude>com/ibm/research/kar/standalone/**</exclude>
	      </excludes>
	    </configuration>
	  </plugin>
	  <plugin>
	    <artifactId>maven-surefire-plugin</artifactId>
	    <version>${surefire-plugin.version}</version>
	    <configuration>
	      <systemPropertyVariables>
		<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
		<maven.home>${maven.home}</maven.home>
	      </systemPropertyVariables>
	    </configuration>
	  </plugin>
	</plugins>
      </build>
    </profile>
    <profile>
      <id>native</id>
      <activation>
	<property>
	  <name>native</name>
	</property>
      </activation>
      <dependencyManagement>
	<dependencies>
	  <dependency>
	    <groupId>${quarkus.platform.group-id}</groupId>
	    <artifactId>${quarkus.platform.artifact-id}</artifactId>
	    <version>${quarkus.platform.version}</version>
	    <type>pom</type>
	    <scope>import</scope>
	  </dependency>
	</dependencies>
      </dependencyManagement>
      <dependencies>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-jsonb</artifactId>
	</dependency>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-resteasy</artifactId>
	</dependency>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-arc</artifactId>
	</dependency>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-junit5</artifactId>
	  <scope>test</scope>
	</dependency>
	<dependency>
	  <groupId>io.rest-assured</groupId>
	  <artifactId>rest-assured</artifactId>
	  <scope>test</scope>
	</dependency>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-rest-client</artifactId>
	</dependency>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-smallrye-fault-tolerance</artifactId>
	</dependency>
	<dependency>
	  <groupId>io.quarkus</groupId>
	  <artifactId>quarkus-rest-client-jsonb</artifactId>
	</dependency>
      </dependencies>
      <build>
	<finalName>${project.artifactId}-native-${project.version}</finalName>
	<plugins>
	  <plugin>
	    <groupId>org.jboss.jandex</groupId>
	    <artifactId>jandex-maven-plugin</artifactId>
	    <version>${jandex-plugin.version}</version>
	    <executions>
	      <execution>
		<id>make-index</id>
		<goals>
		  <goal>jandex</goal>
		</goals>
	      </execution>
	    </executions>
	  </plugin>
	  <plugin>
	    <groupId>io.quarkus</groupId>
	    <artifactId>quarkus-maven-plugin</artifactId>
	    <version>${quarkus-plugin.version}</version>
	    <executions>
	      <execution>
		<goals>
		  <goal>build</goal>
		  <goal>generate-code</goal>
		  <goal>generate-code-tests</goal>
		</goals>
	      </execution>
	    </executions>
	  </plugin>
	  <plugin>
	    <artifactId>maven-compiler-plugin</artifactId>
	    <version>${version.maven-compiler-plugin}</version>
	    <configuration>
	      <release>${version.java-compiler}</release>
	      <excludes>
		<exclude>com/ibm/research/kar/standalone/**</exclude>
	      </excludes>
	    </configuration>
	  </plugin>
	  <plugin>
	    <artifactId>maven-surefire-plugin</artifactId>
	    <version>${surefire-plugin.version}</version>
	    <configuration>
	      <systemPropertyVariables>
		<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
		<maven.home>${maven.home}</maven.home>
	      </systemPropertyVariables>
	    </configuration>
	  </plugin>
	  <plugin>
	    <artifactId>maven-failsafe-plugin</artifactId>
	    <version>${surefire-plugin.version}</version>
	    <executions>
	      <execution>
		<goals>
		  <goal>integration-test</goal>
		  <goal>verify</goal>
		</goals>
		<configuration>
		  <systemPropertyVariables>
		    <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
		    <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
		    <maven.home>${maven.home}</maven.home>
		  </systemPropertyVariables>
		</configuration>
	      </execution>
	    </executions>
	  </plugin>
	</plugins>
      </build>
      <properties>
	<quarkus.package.type>native</quarkus.package.type>
      </properties>
    </profile>
  </profiles>
</project>
