<?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>celesta-parent</artifactId>
    <version>7.3.21</version>
    <name>celesta-parent</name>
    <description>celesta - LGPL platform for business logic development</description>
    <packaging>pom</packaging>
    <url>https://corchestra.ru/wiki/index.php?title=Celesta</url>

    <modules>
        <module>celesta-documentation</module>
        <module>celesta-unit</module>
        <module>celesta-test</module>
        <module>celesta-sql</module>
        <module>celesta-maven-plugin</module>
        <module>celesta-core</module>
        <module>celesta-system-services</module>
    </modules>

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

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

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

    <developers>
        <developer>
            <name>Ivan Ponomarev</name>
            <email>ponomarev@corchestra.ru</email>
        </developer>
        <developer>
            <name>Ivan Golovko</name>
            <email>ioanngolovko@gmail.com</email>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <version>${project.version}</version>

        <!--dependency versions -->
        <checkstyle.version>8.36.2</checkstyle.version>
        <slf4j.version>1.7.30</slf4j.version>
        <h2.version>1.4.200</h2.version>
        <javacc.version>7.0.9</javacc.version>
        <jdbc.driver.oracle.version>11.2.0.4</jdbc.driver.oracle.version>
        <jdbc.driver.postgres.version>42.2.17</jdbc.driver.postgres.version>
        <jdbc.driver.sqlserver.version>8.2.1.jre8</jdbc.driver.sqlserver.version>
        <jdbc.driver.firebird.version>4.0.0-beta-1</jdbc.driver.firebird.version>
        <junit.version>5.7.0</junit.version>
        <org.json.version>20200518</org.json.version>
        <testcontainers.version>1.14.3</testcontainers.version>
        <testcontainers.firebird.version>1.0.4</testcontainers.firebird.version>

        <!--plugin versions -->
        <spotbugs.maven.plugin.version>3.1.8</spotbugs.maven.plugin.version>
        <jacoco.version>0.8.6</jacoco.version>
        <javacc.maven.plugin.version>2.6</javacc.maven.plugin.version>
        <maven.assembly.plugin.version>3.3.0</maven.assembly.plugin.version>
        <maven.checkstyle.plugin.version>3.1.1</maven.checkstyle.plugin.version>
        <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
        <maven.deploy.plugin.version>2.8.2</maven.deploy.plugin.version>
        <maven.jar.plugin.version>3.2.0</maven.jar.plugin.version>
        <maven.javadoc.plugin.version>3.2.0</maven.javadoc.plugin.version>
        <maven.shade.plugin.version>3.2.4</maven.shade.plugin.version>
        <maven.source.plugin.version>3.2.1</maven.source.plugin.version>
        <maven.surefire.plugin.version>2.22.2</maven.surefire.plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.json</groupId>
                <artifactId>json</artifactId>
                <version>${org.json.version}</version>
            </dependency>
            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>${jdbc.driver.postgres.version}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>com.microsoft.sqlserver</groupId>
                <artifactId>mssql-jdbc</artifactId>
                <version>${jdbc.driver.sqlserver.version}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>com.oracle.database.jdbc</groupId>
                <artifactId>ojdbc6</artifactId>
                <version>${jdbc.driver.oracle.version}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.firebirdsql.jdbc</groupId>
                <artifactId>jaybird-jdk18</artifactId>
                <version>${jdbc.driver.firebird.version}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>${slf4j.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <version>${h2.version}</version>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>postgresql</artifactId>
                <version>${testcontainers.version}</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.postgresql</groupId>
                        <artifactId>postgresql</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>oracle-xe</artifactId>
                <version>${testcontainers.version}</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>com.oracle</groupId>
                        <artifactId>ojdbc6</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>mssqlserver</artifactId>
                <version>${testcontainers.version}</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>com.microsoft.sqlserver</groupId>
                        <artifactId>mssql-jdbc</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.firebirdsql</groupId>
                <artifactId>firebird-testcontainers-java</artifactId>
                <version>${testcontainers.firebird.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.firebirdsql.jdbc</groupId>
                        <artifactId>jaybird-jdk18</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <!--
                    TURN ON this flag if you build project on Java version greater than 8.
                    <release>8</release>
                    -->
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>utf-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>javacc-maven-plugin</artifactId>
                    <version>${javacc.maven.plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>net.java.dev.javacc</groupId>
                            <artifactId>javacc</artifactId>
                            <version>${javacc.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven.source.plugin.version}</version>
                    <executions>
                        <execution>
                            <!-- This id must match the -Prelease-profile id value
                            or else sources will be "uploaded" twice, which causes repo to fail -->
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>${maven.assembly.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven.javadoc.plugin.version}</version>
                    <configuration>
                        <show>public</show>
                        <attach>true</attach>
                        <maxmemory>1024m</maxmemory>
                        <additionalparam>-Xdoclint:none</additionalparam>
                        <failOnError>false</failOnError>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>aggregate</id>
                            <goals>
                                <goal>aggregate</goal>
                            </goals>
                            <phase>site</phase>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven.jar.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>${maven.shade.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven.deploy.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco.version}</version>
                    <executions>
                        <execution>
                            <id>prepare-agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>report</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <includes>
                                    <!--Do not include generated test cursors-->
                                    <include>
                                        ru/curs/**/*
                                    </include>
                                </includes>
                            </configuration>
                        </execution>
                        <execution>
                            <id>post-unit-test</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <!-- Sets the path to the file which contains the execution data. -->

                                <dataFile>target/jacoco.exec</dataFile>
                                <!-- Sets the output directory for the code coverage report. -->
                                <outputDirectory>target/jacoco-ut</outputDirectory>
                            </configuration>
                        </execution>
                        <execution>
                            <id>check</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <rule>
                                        <element>CLASS</element>
                                        <limits>
                                            <limit>
                                                <counter>LINE</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>0</minimum>
                                            </limit>
                                            <limit>
                                                <counter>BRANCH</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>0</minimum>
                                            </limit>
                                        </limits>
                                    </rule>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                    <configuration>
                        <systemPropertyVariables>
                            <jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>dev</id>
            <build>
                <plugins>
                    <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>
                        <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.apache.maven.plugins</groupId>
                        <artifactId>maven-site-plugin</artifactId>
                        <configuration>
                            <reportPlugins>
                                <plugin>
                                    <groupId>com.github.spotbugs</groupId>
                                    <artifactId>spotbugs-maven-plugin</artifactId>
                                    <configuration>
                                        <effort>Max</effort>
                                        <threshold>Low</threshold>
                                    </configuration>
                                </plugin>
                            </reportPlugins>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <reporting>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <version>${maven.checkstyle.plugin.version}</version>
                        <configuration>
                            <configLocation>checkstyle.xml</configLocation>
                        </configuration>
                        <reportSets>
                            <reportSet>
                                <reports>
                                    <report>checkstyle</report>
                                </reports>
                            </reportSet>
                        </reportSets>
                    </plugin>
                </plugins>
            </reporting>
        </profile>
        <profile>
            <id>corchestra-release</id>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
