<?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>xyz.cofe</groupId>
    <artifactId>next-parent</artifactId>
    <version>1.2</version>
    <packaging>pom</packaging>

    <name>common-parent for cofe.xyz-next</name>
    <description>parent for common lib for any platform</description>
    <url>https://github.com/gochaorg/cofe.xyz-next</url>

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

    <developers>
        <developer>
            <name>Georgiy P Kamnev</name>
            <email>nt.gocha@gmail.com</email>
            <!-- <organization>-none-</organization> -->
            <!-- <organizationUrl>http://www.sonatype.com</organizationUrl> -->
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!--        <maven.compiler.source>8</maven.compiler.source>-->
        <!--        <maven.compiler.target>8</maven.compiler.target>-->
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
        <timestamp>${maven.build.timestamp}</timestamp>
    </properties>

    <!-- Подключение git для хранения исходников -->
    <scm>
        <connection>scm:git:git@github.com:gochaorg/cofe.xyz-next.git</connection>
        <url>scm:git:git@github.com:gochaorg/cofe.xyz-next.git</url>
        <developerConnection>scm:git:git@github.com:gochaorg/cofe.xyz-next.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>[4.13.1,)</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>disable-java8-doclint</id>
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
            <properties>
                <additionalparam>-Xdoclint:none</additionalparam>
            </properties>
        </profile>

        <!-- Поддержка multi-release jar -->
        <profile>
            <id>jdk11</id>
            <activation>
                <jdk>[11,)</jdk>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-compiler-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>jdk11</id>
                                    <goals>
                                        <goal>compile</goal>
                                    </goals>
                                    <configuration>
                                        <release>11</release>
                                        <compileSourceRoots>
                                            <compileSourceRoot>${project.basedir}/src/main/java-mr/11</compileSourceRoot>
                                            <compileSourceRoot>${project.basedir}/src/main/java</compileSourceRoot>
                                        </compileSourceRoots>
                                        <outputDirectory>${project.build.outputDirectory}/META-INF/versions/11</outputDirectory>
                                        <compilerArgs>
                                            <!--                                            <arg>&#45;&#45;patch-module</arg>-->
                                            <!--                                            <arg>example.mrjar=${project.build.outputDirectory}</arg>-->
                                            <arg>-g</arg>
                                        </compilerArgs>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-jar-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>default-jar</id>
                                    <configuration>
                                        <archive>
                                            <manifestEntries>
                                                <Multi-Release>true</Multi-Release>
                                            </manifestEntries>
                                        </archive>
                                        <excludes>
                                            <exclude>**/versions/11/xyz/**</exclude>
                                        </excludes>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

        <profile>
            <id>pub-sonatype</id>
            <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>

            <build>
                <plugins>
                    <!-- Поддержка junit -->
<!--                    <plugin>-->
<!--                        <groupId>org.apache.maven.plugins</groupId>-->
<!--                        <artifactId>maven-surefire-plugin</artifactId>-->
<!--                        <version>2.15</version>-->
<!--                    </plugin>-->

                    <!-- Поддержка Service Provider Interfaces -->
<!--                    <plugin>-->
<!--                        <groupId>eu.somatik.serviceloader-maven-plugin</groupId>-->
<!--                        <artifactId>serviceloader-maven-plugin</artifactId>-->
<!--                        <version>1.0.3</version>-->
<!--                        <configuration>-->
<!--                            <services>-->
<!--                                <param>xyz.cofe.types.spi.ConvertToStringService</param>-->
<!--                                <param>xyz.cofe.types.spi.ConvertToValueService</param>-->
<!--                                <param>xyz.cofe.typeconv.spi.GetTypeConvertor</param>-->
<!--                                <param>xyz.cofe.fs.spi.OSFileSystemService</param>-->
<!--                                <param>xyz.cofe.sql.ConnectionPoolService</param>-->
<!--                            </services>-->
<!--                        </configuration>-->
<!--                        <executions>-->
<!--                            <execution>-->
<!--                                <goals>-->
<!--                                    <goal>generate</goal>-->
<!--                                </goals>-->
<!--                            </execution>-->
<!--                        </executions>-->
<!--                    </plugin>-->

                    <!-- Копиляция -->
<!--                    <plugin>-->
<!--                        <groupId>org.apache.maven.plugins</groupId>-->
<!--                        <artifactId>maven-compiler-plugin</artifactId>-->
<!--                        <version>2.3.2</version>-->
<!--                        <configuration>-->
<!--                            <showDeprecation>true</showDeprecation>-->
<!--                        </configuration>-->
<!--                    </plugin>-->

                    <!-- Архив исходников -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Документация java исходников -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
<!--                        <version>2.9.1</version>-->
                        <version>3.1.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.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Публикация в oss.sonatype.org -->
                    <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>

<!--                <testResources>-->
<!--                    <testResource>-->
<!--                        <directory>${project.basedir}/src/test/java</directory>-->
<!--                    </testResource>-->
<!--                </testResources>-->
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
<!--                <version>3.1.0</version>-->
                <version>3.1.1</version>
                <configuration>
                    <failOnError>false</failOnError>
                </configuration>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.ow2.asm</groupId>
                        <artifactId>asm</artifactId>
                        <version>6.2</version> <!-- Use newer version of ASM -->
                    </dependency>
                </dependencies>
            </plugin>

            <!-- Версионность -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.0.0-M1</version>
                <configuration>
                    <preparationGoals>clean install</preparationGoals>
                    <goals>deploy</goals>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                </configuration>
            </plugin>

            <!-- Поддержка junit -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.15</version>
            </plugin>

        </plugins>
    </build>

</project>