<?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>
    <parent>
        <groupId>org.openl.rules</groupId>
        <artifactId>openl-tablets</artifactId>
        <version>5.23.3</version>
        <relativePath>../..</relativePath>
    </parent>
    <artifactId>openl-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <name>OpenL Maven Plugin</name>
    <url>https://openl-tablets.org</url>
    <organization>
        <name>OpenL Tablets</name>
        <url>https://openl-tablets.org</url>
    </organization>
    <properties>
        <!-- 512MB Should be enough to don't fall in OutOfMemoryError -->
        <invoker.mavenOpts>-Xms16m -Xmx512m</invoker.mavenOpts>
        <invoker.timeoutInSeconds>0</invoker.timeoutInSeconds>
        <big-tableparts.mavenOpts>${invoker.mavenOpts}</big-tableparts.mavenOpts>
        <big-tableparts.timeoutInSeconds>${invoker.timeoutInSeconds}</big-tableparts.timeoutInSeconds>
        <big-testsuite.mavenOpts>${invoker.mavenOpts}</big-testsuite.mavenOpts>
        <big-testsuite.timeoutInSeconds>${invoker.timeoutInSeconds}</big-testsuite.timeoutInSeconds>
        <gen-spreadsheetresult.mavenOpts>${invoker.mavenOpts}</gen-spreadsheetresult.mavenOpts>
        <gen-spreadsheetresult.timeoutInSeconds>${invoker.timeoutInSeconds}</gen-spreadsheetresult.timeoutInSeconds>
        <recompile.timeoutInSeconds>${invoker.timeoutInSeconds}</recompile.timeoutInSeconds>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
        </dependency>
        <!-- dependencies to annotations -->
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.helger</groupId>
            <artifactId>jcodemodel</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openl.rules</groupId>
            <artifactId>org.openl.rules.project</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openl.rules</groupId>
            <artifactId>org.openl.rules.workspace</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openl.rules</groupId>
            <artifactId>org.openl.rules.repository</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openl.rules</groupId>
            <artifactId>org.openl.rules.ruleservice.deployer</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <reporting>
        <plugins>
            <plugin>
                <!-- generate MOJOs documents -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
            </plugin>
            <plugin>
                <!-- Do not generate project reports -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <reportSets>
                    <reportSet>
                        <reports />
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pdf-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>pdf</goal>
                        </goals>
                        <phase>site</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>it</id>
            <activation>
                <property>
                    <name>!skipTests</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>install</goal>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <projectsDirectory>it</projectsDirectory>
                            <pomIncludes>
                                <pomInclude>*/pom.xml</pomInclude>
                            </pomIncludes>
                            <preBuildHookScript>setup</preBuildHookScript>
                            <postBuildHookScript>verify</postBuildHookScript>
                            <goals>
                                <goal>clean</goal>
                                <goal>verify</goal>
                            </goals>
                            <streamLogs>true</streamLogs>
                            <useLocalRepository>true</useLocalRepository>
                            <properties>
                                <maven.compiler.source>${java.source.version}</maven.compiler.source>
                                <maven.compiler.target>${java.target.version}</maven.compiler.target>
                            </properties>
                            <showErrors>true</showErrors>
                            <!-- Estimated test's time should not take more than 10 sec on 4х CPU (2GHz) -->
                            <!-- with limited amount of memory. It allows to detect memory leaks. -->
                            <!-- Special cases should be defined in invoker.properties file. -->
                            <!-- !!! Don't increase these parameters without special need !!! -->
                            <timeoutInSeconds>${invoker.timeoutInSeconds}</timeoutInSeconds>
                            <mavenOpts>${jacoco.argLine} ${invoker.mavenOpts}</mavenOpts>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.openl.rules</groupId>
                    <artifactId>org.openl.rules.ruleservice.annotation</artifactId>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.openl.rules</groupId>
                    <artifactId>org.openl.rules.calculation.result</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>perf</id>
            <activation>
                <property>
                    <name>!noPerf</name>
                </property>
            </activation>
            <properties>
                <!-- Fine tuned settings to detects memory and performance issues -->
                <invoker.mavenOpts>-Xms16m -Xmx40m</invoker.mavenOpts>
                <invoker.timeoutInSeconds>30</invoker.timeoutInSeconds>
                <big-tableparts.mavenOpts>${jacoco.argLine} -Xms32m -Xmx256m</big-tableparts.mavenOpts>
                <big-tableparts.timeoutInSeconds>60</big-tableparts.timeoutInSeconds>
                <big-testsuite.mavenOpts>${jacoco.argLine} -Xms32m -Xmx96m</big-testsuite.mavenOpts>
                <big-testsuite.timeoutInSeconds>150</big-testsuite.timeoutInSeconds>
                <gen-spreadsheetresult.mavenOpts>${jacoco.argLine} -Xms32m -Xmx256m</gen-spreadsheetresult.mavenOpts>
                <gen-spreadsheetresult.timeoutInSeconds>60</gen-spreadsheetresult.timeoutInSeconds>
                <!-- due double work of packaging: 30s * 2 -->
                <recompile.timeoutInSeconds>60</recompile.timeoutInSeconds>
            </properties>
        </profile>
    </profiles>
</project>
