<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>ru.curs</groupId>
    <artifactId>xylophone</artifactId>
    <version>6.1.52</version>
    <packaging>jar</packaging>

    <name>xylophone java library</name>
    <description>xylophone - LGPL Java library</description>
    <url>https://courseorchestra.github.io/xylophone</url>

    <organization>
        <name>CURS</name>
        <url>https://corchestra.ru</url>
    </organization>

    <scm>
        <url>https://github.com/CourseOrchestra/xylophone.git</url>
        <connection>scm:git:git://github.com/CourseOrchestra/xylophone.git</connection>
        <developerConnection>scm:git:git://github.com/CourseOrchestra/xylophone.git</developerConnection>
    </scm>

    <licenses>
        <license>
            <name>GNU Lesser General Public License (LGPL), Version 3</name>
            <url>https://www.gnu.org/licenses/lgpl.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Ivan Ponomarev</name>
            <email>iponomarev@mail.ru</email>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <junit.version>4.13.1</junit.version>
        <mockito.version>3.9.0</mockito.version>
        <poi.version>3.17</poi.version>
        <xmlgraphics.version>2.1</xmlgraphics.version>
        <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
        <maven.appassembler.plugin.version>2.1.0</maven.appassembler.plugin.version>
        <maven.assembly.plugin.version>3.3.0</maven.assembly.plugin.version>
        <maven.jar.plugin.version>3.2.0</maven.jar.plugin.version>
        <spotbugs.maven.plugin.version>4.2.2</spotbugs.maven.plugin.version>
        <checkstyle.version>8.41.1</checkstyle.version>
        <maven.checkstyle.plugin.version>3.1.2</maven.checkstyle.plugin.version>
        <maven.source.plugin.version>3.2.1</maven.source.plugin.version>
        <maven.javadoc.plugin.version>3.2.0</maven.javadoc.plugin.version>
    </properties>

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

    <dependencies>
        <!--Apache POI-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>${poi.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>${poi.version}</version>
            <scope>compile</scope>
        </dependency>

        <!--Apache xml-->
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>fop</artifactId>
            <version>${xmlgraphics.version}</version>
        </dependency>

        <!--For Test-->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>2.1.0</version>
                <dependencies>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj-diagram</artifactId>
                        <version>2.1.2</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <sourceDocumentName>userguide.adoc</sourceDocumentName>
                    <requires>
                        <require>asciidoctor-diagram</require>
                    </requires>
                    <outputFile>index.html</outputFile>
                    <logHandler>
                        <outputToConsole>true</outputToConsole>
                        <failIf>
                            <severity>WARN</severity>
                        </failIf>
                    </logHandler>
                </configuration>
                <executions>
                    <execution>
                        <id>asciidoc-to-html</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>html5</backend>
                            <sourceHighlighter>coderay</sourceHighlighter>
                            <attributes>
                                <project-version>${project.version}</project-version>
                            </attributes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>appassembler-maven-plugin</artifactId>
                <version>${maven.appassembler.plugin.version}</version>
                <configuration>
                    <programs>
                        <program>
                            <mainClass>ru.curs.xylophone.Main</mainClass>
                            <id>xylophone</id>
                        </program>
                    </programs>
                    <repositoryName>lib</repositoryName>
                    <repositoryLayout>flat</repositoryLayout>
                    <licenseHeaderFile>src/main/assembly/header.txt</licenseHeaderFile>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>assemble</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven.assembly.plugin.version}</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <descriptors>
                        <descriptor>src/main/assembly/bin.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven.jar.plugin.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>ru.curs.xylophone.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven.checkstyle.plugin.version}</version>
                <configuration>
                    <configLocation>checkstyle.xml</configLocation>
                    <failsOnError>false</failsOnError>
                    <encoding>UTF-8</encoding>
                    <consoleOutput>true</consoleOutput>
                </configuration>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>checkstyle</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>${checkstyle.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${spotbugs.maven.plugin.version}</version>
                <configuration>
                    <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
                </configuration>
                <executions>
                    <execution>
                        <id>check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>spotbugs</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.8</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <profiles>
        <!--source and Javadoc-->
        <profile>
            <id>publication</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven.source.plugin.version}</version>
                        <configuration>
                            <attach>true</attach>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven.javadoc.plugin.version}</version>
                        <configuration>
                            <source>8</source>
                            <show>public</show>
                            <attach>true</attach>
                            <maxmemory>1024m</maxmemory>
                            <excludePackageNames>org.apache.poi.*</excludePackageNames>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!--signing-->
        <profile>
            <id>gpg</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
