<?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>
        <artifactId>intersmash-parent</artifactId>
        <groupId>org.jboss.intersmash</groupId>
        <version>0.0.3.Beta2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>intersmash-provisioners</artifactId>

    <name>Intersmash Provisioners</name>

    <properties>
        <logDirectory>${basedir}/log/test-logs</logDirectory>
        <version.org.keycloak.keycloak-admin-client>26.0.3</version.org.keycloak.keycloak-admin-client>

        <formatting-style-base-directory>${project.parent.basedir}/ide-config</formatting-style-base-directory>
    </properties>

    <dependencies>
        <!-- used to provide Intersmash Maven utils, e.g.: for getting deployment archives locally -->
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-connector-basic</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-transport-file</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-aether-provider</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-settings</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-settings-builder</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
        </dependency>
        <dependency>
            <groupId>cz.xtf</groupId>
            <artifactId>core</artifactId>
        </dependency>
        <dependency>
            <groupId>cz.xtf</groupId>
            <artifactId>builder</artifactId>
        </dependency>
        <dependency>
            <groupId>cz.xtf</groupId>
            <artifactId>http-client</artifactId>
        </dependency>
        <dependency>
            <groupId>cz.xtf</groupId>
            <artifactId>junit5</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.intersmash</groupId>
            <artifactId>intersmash-kubernetes-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.intersmash</groupId>
            <artifactId>intersmash-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap</groupId>
            <artifactId>shrinkwrap-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
        <!-- java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-admin-client</artifactId>
            <version>${version.org.keycloak.keycloak-admin-client}</version>
        </dependency>
        <!-- Kafka operator API -->
        <dependency>
            <groupId>io.strimzi</groupId>
            <artifactId>api</artifactId>
        </dependency>
        <!-- Hyperfoil generate code needs the following to compile-->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>io.gsonfire</groupId>
            <artifactId>gson-fire</artifactId>
        </dependency>
        <dependency>
            <groupId>org.threeten</groupId>
            <artifactId>threetenbp</artifactId>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>logging-interceptor</artifactId>
        </dependency>
        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
        </dependency>
        <!-- The Hyperfoil provisioner Java model still relies on javax... -->
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>2.1.1</version>
        </dependency>
        <!-- ActiveMQ Operator provisioner generated JOSDK still relies on this -->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>

        <dependency>
            <groupId>uk.org.webcompere</groupId>
            <artifactId>system-stubs-jupiter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>generator-annotations</artifactId>
        </dependency>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>kubernetes-model-core</artifactId>
        </dependency>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>kubernetes-model</artifactId>
        </dependency>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>kubernetes-client</artifactId>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>kubernetes-client-api</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
        </dependency>
        <!--
            The following dependencies are required by the Fabric8 Kubernetes client Java generator plugin, see below
            Since the generated classes will use Sundrio and Lombok annotations
        -->
        <dependency>
            <groupId>io.sundr</groupId>
            <artifactId>builder-annotations</artifactId>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <!--
                We want for tests to be executed by Surefire, but we also add an XTF system property to the inherited
                configuration for Intersmash provisioners.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration combine.children="append">
                    <systemProperties>
                        <xtf.record.dir>${logDirectory}</xtf.record.dir>
                    </systemProperties>
                </configuration>
            </plugin>

            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>java-generator-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-crd-generation</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <target>target/generated-sources</target>
                            <source>src/main/resources/crds</source>
                            <!--
                                This is needed to force the Java generator from CRD to stick with the original names
                                for enums, and avoid to uppercase them, since this could generate duplicate names,
                                as in https://github.com/infinispan/infinispan-operator/blob/2.3.4.Final/config/crd/bases/infinispan.org_infinispans.yaml#L1473-L1477
                             -->
                            <enumUppercase>false</enumUppercase>
                            <!--
                                The following is required in order to generate Sundrio and Lombok annotations
                            -->
                            <extraAnnotations>true</extraAnnotations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jsonschema2pojo</groupId>
                <artifactId>jsonschema2pojo-maven-plugin</artifactId>
                <configuration>
                    <generateBuilders>true</generateBuilders>
                </configuration>
                <executions>
                    <execution>
                        <id>charts.values.generate-schema-model.wildfly</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <!-- WildFly Helm Chart model is generated from JSON schema at https://github.com/wildfly/wildfly-charts/blob/wildfly-2.4.0/charts/wildfly/values.schema.json -->
                            <sourceDirectory>${basedir}/src/main/resources/org/jboss/intersmash/provision/helm/values/schema/wildfly</sourceDirectory>
                            <outputDirectory>target/generated-sources</outputDirectory>
                            <targetPackage>org.jboss.intersmash.model.helm.charts.values.wildfly</targetPackage>
                        </configuration>
                    </execution>
                    <execution>
                        <id>charts.values.generate-schema-model.eap8</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <!-- JBoss EAP 8 Helm Chart model is generated from JSON schema at https://github.com/jbossas/eap-charts/blob/eap8-1.1.1/charts/eap8/values.schema.json -->
                            <sourceDirectory>${basedir}/src/main/resources/org/jboss/intersmash/provision/helm/values/schema/eap8</sourceDirectory>
                            <outputDirectory>${project.build.directory}/generated-sources/</outputDirectory>
                            <targetPackage>org.jboss.intersmash.model.helm.charts.values.eap8</targetPackage>
                        </configuration>
                    </execution>

                    <execution>
                        <id>charts.values.generate-schema-model.eap81</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <!-- JBoss EAP 8 Helm Chart model is generated from JSON schema at https://github.com/jbossas/eap-charts/blob/eap81-dev/charts/eap81/values.schema.json -->
                            <sourceDirectory>${basedir}/src/main/resources/org/jboss/intersmash/provision/helm/values/schema/eap81</sourceDirectory>
                            <outputDirectory>${project.build.directory}/generated-sources/</outputDirectory>
                            <targetPackage>org.jboss.intersmash.model.helm.charts.values.eap81</targetPackage>
                        </configuration>
                    </execution>

                    <execution>
                        <id>charts.values.generate-schema-model.xp5</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <!-- JBoss EAP XP 5 Helm Chart model is generated from JSON schema at https://github.com/jbossas/eap-charts/eap-xp5-dev/charts/eap-xp5/values.schema.json -->
                            <sourceDirectory>${basedir}/src/main/resources/org/jboss/intersmash/provision/helm/values/schema/xp5</sourceDirectory>
                            <outputDirectory>${project.build.directory}/generated-sources/</outputDirectory>
                            <targetPackage>org.jboss.intersmash.model.helm.charts.values.xp5</targetPackage>
                        </configuration>
                    </execution>

                    <execution>
                        <id>charts.values.generate-schema-model.xp6</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <!-- JBoss EAP XP 6 Helm Chart model is generated from JSON schema at https://github.com/jbossas/eap-charts/eap-xp6-dev/charts/eap-xp6/values.schema.json -->
                            <sourceDirectory>${basedir}/src/main/resources/org/jboss/intersmash/provision/helm/values/schema/xp6</sourceDirectory>
                            <outputDirectory>${project.build.directory}/generated-sources/</outputDirectory>
                            <targetPackage>org.jboss.intersmash.model.helm.charts.values.xp6</targetPackage>
                        </configuration>
                    </execution>

                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>jboss-release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                    </plugin>
                    <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>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>gpg-sign</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
