<?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>

    <groupId>com.charlyghislain.authenticator</groupId>
    <artifactId>authenticator-parent</artifactId>
    <version>1.0.6</version>
    <modules>
        <module>authenticator-api</module>
        <module>authenticator-admin-api</module>
        <module>authenticator-application-api</module>
        <module>authenticator-domain</module>
        <module>authenticator-application-client</module>
        <module>authenticator-ejb</module>
        <module>authenticator-admin</module>
        <module>authenticator</module>
        <module>authenticator-web</module>
        <module>examples</module>
        <module>authenticator-management-api</module>
        <module>authenticator-management</module>
    </modules>
    <packaging>pom</packaging>

    <name>${project.groupId}:${project.artifactId}</name>
    <description>A JWT producer to be used with applications using the miroprofile-jwt api</description>
    <url>https://github.com/cghislai/authenticator</url>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Charles Ghislain</name>
            <email>charlyghislain@gmail.com</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/cghislai/authenticator.git</connection>
        <developerConnection>scm:git:ssh://github.com:cghislai/authenticator.git</developerConnection>
        <url>http://github.com/cghislai/authenticator/tree/master</url>
    </scm>

    <properties>
        <typescript.api.npm.version>${project.version}</typescript.api.npm.version>
        <dispatcher.version>2.0.1</dispatcher.version>
        <!-- To be set by other plugins -->
        <!--suppress UnresolvedMavenProperty -->
        <annotatedJdk>${org.checkerframework:jdk8:jar}</annotatedJdk>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.charlyghislain.authenticator</groupId>
                <artifactId>authenticator-admin-api</artifactId>
                <version>1.0.6</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.charlyghislain.authenticator</groupId>
                <artifactId>authenticator-application-api</artifactId>
                <version>1.0.6</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.charlyghislain.authenticator</groupId>
                <artifactId>authenticator-api</artifactId>
                <version>1.0.6</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.charlyghislain.authenticator</groupId>
                <artifactId>authenticator-domain</artifactId>
                <version>1.0.6</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.charlyghislain.authenticator</groupId>
                <artifactId>authenticator-ejb</artifactId>
                <version>1.0.6</version>
                <type>ejb</type>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.charlyghislain.authenticator</groupId>
                <artifactId>authenticator-management-api</artifactId>
                <version>1.0.6</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>com.charlyghislain.dispatcher</groupId>
                <artifactId>dispatcher-api</artifactId>
                <version>${dispatcher.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.charlyghislain.dispatcher</groupId>
                <artifactId>dispatcher</artifactId>
                <version>${dispatcher.version}</version>
                <type>ejb</type>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>2.0.1.Final</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.eclipse.microprofile.openapi</groupId>
                <artifactId>microprofile-openapi-api</artifactId>
                <version>1.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>jaxrs-api</artifactId>
                <version>3.0.6.Final</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.checkerframework</groupId>
                <artifactId>checker-qual</artifactId>
                <version>2.5.2</version>
            </dependency>
            <dependency>
                <groupId>org.checkerframework</groupId>
                <artifactId>jdk8</artifactId>
                <version>2.5.2</version>
            </dependency>
            <dependency>
                <groupId>javax.persistence</groupId>
                <artifactId>javax.persistence-api</artifactId>
                <version>2.2</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.enterprise</groupId>
                <artifactId>cdi-api</artifactId>
                <version>2.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.eclipse.microprofile.rest.client</groupId>
                <artifactId>microprofile-rest-client-api</artifactId>
                <version>1.1</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.ejb</groupId>
                <artifactId>javax.ejb-api</artifactId>
                <version>3.2</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.security.enterprise</groupId>
                <artifactId>javax.security.enterprise-api</artifactId>
                <version>1.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.25</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.eclipse.microprofile.config</groupId>
                <artifactId>microprofile-config-api</artifactId>
                <version>1.3</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.annotation</groupId>
                <artifactId>javax.annotation-api</artifactId>
                <version>1.3.2</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.eclipse.microprofile.health</groupId>
                <artifactId>microprofile-health-api</artifactId>
                <version>1.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>4.0.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.eclipse.microprofile.jwt</groupId>
                <artifactId>microprofile-jwt-auth-api</artifactId>
                <version>1.1</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.activation</groupId>
                <artifactId>javax.activation-api</artifactId>
                <version>1.2.0</version>
            </dependency>
            <dependency>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
                <version>2.3.0</version>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-impl</artifactId>
                <version>2.3.0</version>
            </dependency>
        </dependencies>
    </dependencyManagement>


    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                    <configuration>
                        <source>8</source>
                        <target>8</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-ejb-plugin</artifactId>
                    <version>3.0.1</version>
                    <configuration>
                        <ejbVersion>3.0</ejbVersion>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.0.0</version>
                    <configuration>
                        <attachClasses>true</attachClasses>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-ear-plugin</artifactId>
                    <version>3.0.1</version>
                    <configuration>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.0.0</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.0.0</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>1.5</version>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>cz.habarta.typescript-generator</groupId>
                    <artifactId>typescript-generator-maven-plugin</artifactId>
                    <version>2.5.423</version>
                    <executions>
                        <execution>
                            <id>generate-admin-api</id>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <excludeClassPatterns>
                            <classPattern>java.io.**</classPattern>
                            <classPattern>java.lang.**</classPattern>
                        </excludeClassPatterns>
                        <jsonLibrary>jackson2</jsonLibrary>
                        <outputFile>target/npm/index.d.ts</outputFile>
                        <outputKind>module</outputKind>
                        <outputFileType>declarationFile</outputFileType>
                        <mapClasses>asInterfaces</mapClasses>
                        <mapEnum>asEnum</mapEnum>
                        <mapDate>asString</mapDate>
                        <generateNpmPackageJson>true</generateNpmPackageJson>
                        <npmName>@charlyghislain/${project.artifactId}</npmName>
                        <npmVersion>${typescript.api.npm.version}</npmVersion>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>ossrh-deploy</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>

                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.7</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <!-- This profile requires compilation using JDK8 -->
            <id>checker</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.checkerframework</groupId>
                    <artifactId>jdk8</artifactId>
                    <scope>compile</scope>
                </dependency>
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-jpamodelgen</artifactId>
                    <version>5.3.1.Final</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>properties</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>8</source>
                            <target>8</target>
                            <compilerArguments>
                                <Xmaxerrs>10000</Xmaxerrs>
                                <Xmaxwarns>10000</Xmaxwarns>
                            </compilerArguments>
                            <annotationProcessorPaths>
                                <path>
                                    <groupId>org.checkerframework</groupId>
                                    <artifactId>checker</artifactId>
                                    <version>2.5.2</version>
                                </path>
                                <path>
                                    <groupId>org.hibernate</groupId>
                                    <artifactId>hibernate-jpamodelgen</artifactId>
                                    <version>5.3.1.Final</version>
                                </path>
                            </annotationProcessorPaths>
                            <annotationProcessors>
                                <!-- Seems this one is not registered with this config -->
                                <annotationProcessor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</annotationProcessor>
                                <!-- Add all the checkers you want to enable here -->
                                <annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker
                                </annotationProcessor>

                            </annotationProcessors>
                            <compilerArgs>
                                <!-- location of the annotated JDK, which comes from a Maven dependency -->
                                <arg>-Xbootclasspath/p:${annotatedJdk}</arg>
                                <!-- -Awarns turns type-checking warnings into errors (or rather the inverse?). -->
                                <arg>-Awarns</arg>
                                <!-- Lots of uninitialized fields: CDI-injection, serialized POJOs,...  -->
                                <arg>-AsuppressWarnings=uninitialized</arg>
                            </compilerArgs>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
