<?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>de.quinscape.domainql</groupId>
    <artifactId>automaton</artifactId>
    <version>0.1.0</version>

    <name>Automaton</name>
    <description>Opinionated convention-over-configuration / model-based application framework based on DomainQL</description>

    <url>https://github.com/quinscape/automaton/</url>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Sven Helmberger</name>
            <email>sven.helmberger@quinscape.de</email>
            <url>https://www.quinscape.de/</url>
        </developer>
    </developers>

    <inceptionYear>2018</inceptionYear>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.code.svenson</groupId>
            <artifactId>svenson</artifactId>
            <version>1.5.8</version>
        </dependency>

        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq-codegen</artifactId>
            <version>3.10.6</version>
        </dependency>

        <dependency>
            <groupId>com.graphql-java</groupId>
            <artifactId>graphql-java</artifactId>
            <version>11.0</version>
        </dependency>

        <dependency>
            <groupId>de.quinscape</groupId>
            <artifactId>spring-jsview</artifactId>
            <version>0.5</version>
        </dependency>


        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>


        <!-- Test dependencies -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.25</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>24.1-jre</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>5.0.5.RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.0.9.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>de.quinscape.domainql</groupId>
            <artifactId>domainql</artifactId>
            <version>0.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-websocket</artifactId>
            <version>5.0.9.RELEASE</version>
            <scope>compile</scope>
        </dependency>

    </dependencies>

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

    <scm>
        <connection>scm:git:https://github.com/quinscape/automaton.git</connection>
        <developerConnection>scm:git:git@github.com:quinscape/automaton.git</developerConnection>
        <url>https://github.com/quinscape/automaton/</url>
        <tag>automaton-0.1.0</tag>
    </scm>

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

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.0.1</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-javadoc-plugin</artifactId>
                <version>2.10.1</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!--
                        Use "@quinscape.de" qualifier for key so we don't always use the default key and developers
                        already using GPG can keep their private key.

                        As-is the key chosen needs to be created with a quinscape mail address.
                    -->
                    <keyname>@quinscape.de</keyname>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <goals>deploy</goals>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            <plugin>

                <!-- Specify the maven code generator plugin -->
                <!-- Use org.jooq            for the Open Source Edition
                         org.jooq.pro        for commercial editions,
                         org.jooq.pro-java-6 for commercial editions with Java 6 support,
                         org.jooq.trial      for the free trial edition

                     Note: Only the Open Source Edition is hosted on Maven Central.
                           Import the others manually from your distribution -->
                <groupId>org.jooq</groupId>
                <artifactId>jooq-codegen-maven</artifactId>
                <version>3.10.6</version>

                <!--
                    The generated classes are only used in tests.

                    To update uncomment the <executions>
                    block below and do a "mvn generate-sources" and then comment the block out again.

                    We don't want to require DB access for the tests to run, we only simulate the db activity in the tests.
                    It is however nice to have JOOQ generate the correct classes based on a real DB.
                 -->
                <!--
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                -->

                <!-- Manage the plugin's dependency. In this example, we'll use a PostgreSQL database -->
                <dependencies>
                    <dependency>
                        <groupId>org.postgresql</groupId>
                        <artifactId>postgresql</artifactId>
                        <version>42.1.4</version>
                    </dependency>
                </dependencies>

                <!-- Specify the plugin configuration.
                     The configuration format is the same as for the standalone code generator -->
                <configuration>

                    <!-- JDBC connection parameters -->
                    <jdbc>
                        <driver>org.postgresql.Driver</driver>
                        <url>jdbc:postgresql://localhost/automaton</url>
                        <user>automaton</user>
                        <password>automaton</password>
                    </jdbc>

                    <!-- Generator parameters -->
                    <generator>
                        <database>
                            <name>org.jooq.util.postgres.PostgresDatabase</name>
                            <includes>.*</includes>
                            <excludes />
                            <!-- In case your database supports catalogs, e.g. SQL Server:
                            <inputCatalog>public</inputCatalog>
                              -->
                            <inputSchema>public</inputSchema>
                        </database>
                        <target>
                            <packageName>de.quinscape.automaton.testdomain</packageName>
                            <directory>src/test/java</directory>
                        </target>
                        <generate>
                            <pojos>true</pojos>
                            <records>true</records>
                            <generatedAnnotation>true</generatedAnnotation>
                            <validationAnnotations>true</validationAnnotations>
                            <jpaAnnotations>true</jpaAnnotations>
                            <springAnnotations>true</springAnnotations>
                        </generate>
                        <strategy>
                            <name>
                                de.quinscape.domainql.jooq.DomainObjectGeneratorStrategy
                            </name>
                        </strategy>
                    </generator>
                </configuration>
            </plugin>

            <!-- Update DomainQL type documentation from Java source -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.5.0</version>
                <executions>
                    <execution>
                        <id>update-typedocs</id>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <phase>generate-resources</phase>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>de.quinscape.domainql.docs.DocsExtractor</mainClass>
                    <arguments>

                        <argument>--sourceRoot</argument>
                        <argument>${project.basedir}/src/main/java</argument>

                        <!-- Documentation for the standard Automaton logic implementations -->
                        <argument>--package</argument>
                        <argument>de.quinscape.automaton.runtime.logic</argument>

                        <!-- Documentation for automaton base models -->
                        <argument>--package</argument>
                        <argument>de.quinscape.automaton.model</argument>

                        <argument>--output</argument>
                        <argument>${project.basedir}/src/main/resources/automaton-typedocs.json</argument>

                        <argument>--pretty</argument>
                    </arguments>
                </configuration>
            </plugin>


        </plugins>
    </build>
</project>

