<?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.agrirouter.proto</groupId>
    <artifactId>agrirouter-api-protobuf-definitions</artifactId>
    <version>1.0.0-jdk11</version>

    <name>AGRIROUTER - API Protobuf Definitions</name>
    <description>This project contains the internal Google Protocol Buffer (protobuf) definitions for the communication
        with the agrirouter. All the definitions are part of the communcation structure of the agrirouter.
        For more informations see the technical integration guide which you can download from the developer section on
        the product website.
    </description>
    <url>https://github.com/DKE-Data/agrirouter-api-protobuf-definitions</url>
    <licenses>
        <license>
            <name>Apache License Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>
    <developers>
        <developer>
            <id>saschadoemer</id>
            <name>Sascha Doemer</name>
            <email>Cf4ThQgxcnxAovOUXTNv@saschadoemer.de</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git:github.com/DKE-Data/agrirouter-api-protobuf-definitions.git</connection>
        <developerConnection>scm:git:git@github.com:DKE-Data/agrirouter-api-protobuf-definitions.git
        </developerConnection>
        <url>https://github.com/DKE-Data/agrirouter-api-protobuf-definitions</url>
    </scm>

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

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>

        <protobuf-java.version>3.5.1</protobuf-java.version>
        <protoc-jar-maven-plugin.version>3.5.1.1</protoc-jar-maven-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
        <maven-source-plugin.version>3.1.0</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
        <maven-jar-plugin.version>3.1.2</maven-jar-plugin.version>
        <maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
        <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
        <maven-scm-provider-gitexe.version>1.9.5</maven-scm-provider-gitexe.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>${protobuf-java.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven-resources-plugin.version}</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/gpg</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/gpg</directory>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>generate-protobuf-api</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.os72</groupId>
                        <artifactId>protoc-jar-maven-plugin</artifactId>
                        <version>${protoc-jar-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <addProtoSources>all</addProtoSources>
                                    <includeStdTypes>true</includeStdTypes>
                                    <inputDirectories>
                                        <include>src/main/resources/com/dke/data/agrirouter/proto</include>
                                    </inputDirectories>
                                    <includeDirectories>
                                        <include>src/main/resources/com/dke/data/agrirouter/proto</include>
                                    </includeDirectories>
                                    <outputTargets>
                                        <outputTarget>
                                            <type>java</type>
                                            <addSources>none</addSources>
                                            <outputDirectory>src/main/java</outputDirectory>
                                        </outputTarget>
                                    </outputTargets>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${nexus-staging-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</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>${maven-source-plugin.version}</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>${maven-javadoc-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <additionalOptions>
                                <additionalOption>-Xdoclint:none</additionalOption>
                            </additionalOptions>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>${maven-deploy-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>default-deploy</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>deploy</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jdk11</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <jdk>11</jdk>
            </activation>
            <properties>
                <maven.compiler.source>11</maven.compiler.source>
                <maven.compiler.target>11</maven.compiler.target>
            </properties>
        </profile>
        <profile>
            <id>jdk10</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <jdk>10</jdk>
            </activation>
            <properties>
                <maven.compiler.source>10</maven.compiler.source>
                <maven.compiler.target>10</maven.compiler.target>
            </properties>
        </profile>
        <profile>
            <id>jdk9</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <jdk>9</jdk>
            </activation>
            <properties>
                <maven.compiler.source>9</maven.compiler.source>
                <maven.compiler.target>9</maven.compiler.target>
            </properties>
        </profile>
        <profile>
            <id>jdk8</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <jdk>1.8</jdk>
            </activation>
            <properties>
                <maven.compiler.source>1.8</maven.compiler.source>
                <maven.compiler.target>1.8</maven.compiler.target>
            </properties>
        </profile>
    </profiles>

</project>
