<?xml version="1.0"?>
<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>${groupId}</groupId>
    <artifactId>${artifactId}</artifactId>
    <packaging>pom</packaging>
    <name>${artifactId}</name>
    <version>${version}</version>
    <description>Module build to build all projects for ${artifactId}</description>

    <scm>
        <!-- TODO: Change this to your SCM URL -->
        <connection>scm:git:https://github.com/strolch-li/strolch.git</connection>
        <developerConnection>scm:git:https://github.com/strolch-li/strolch.git</developerConnection>
        <url>https://github.com/strolch-li/strolch</url>
    </scm>

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

        <jdk.version>21</jdk.version>
        <maven.compiler.source>${jdk.version}</maven.compiler.source>
        <maven.compiler.target>${jdk.version}</maven.compiler.target>

        <!-- compile time dependencies -->
        <slf4j.version>2.0.5</slf4j.version>
        <logback.version>1.4.14</logback.version>
        <gson.version>2.10</gson.version>
        <hikaricp.version>5.0.1</hikaricp.version>
        <postgresql.version>42.5.1</postgresql.version>
        <antlr.version>4.9.3</antlr.version>
        <javaxmail.version>1.6.2</javaxmail.version>
        <csv.version>1.9.0</csv.version>
        <cron.version>1.6.2</cron.version>

        <jakarta.xml.bind-api.version>4.0.2</jakarta.xml.bind-api.version>
        <jakarta.annotation.version>2.1.1</jakarta.annotation.version>
        <jakarta.activation.version>2.1.3</jakarta.activation.version>
        <jakarta.ws.rs-api.version>3.1.0</jakarta.ws.rs-api.version>
        <jakarta.servlet-api.version>6.0.0</jakarta.servlet-api.version>
        <jakarta.websocket.version>2.1.1</jakarta.websocket.version>
        <jersey.version>3.1.5</jersey.version>
        <csrfguard.version>4.3.0-jakarta</csrfguard.version>

        <camel.version>3.22.1</camel.version>

        <pi4j.version>1.4</pi4j.version>

        <strolch.version>2.2.3</strolch.version>
        <strolch-plc.version>2.1.0</strolch-plc.version>

        <!-- test time dependencies -->
        <junit.version>4.13.2</junit.version>
        <hamcrest.version>2.2</hamcrest.version>

        <!-- maven plug-in dependencies -->
        <maven-scm-plugin.version>1.12.2</maven-scm-plugin.version>
        <buildnumber-maven-plugin.version>3.0.0</buildnumber-maven-plugin.version>
        <versions-maven-plugin.version>2.8.1</versions-maven-plugin.version>
        <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <maven-site-plugin.version>3.12.1</maven-site-plugin.version>
        <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
        <maven-war-plugin.version>3.4.0</maven-war-plugin.version>
        <tomcat7-maven-plugin.version>2.2</tomcat7-maven-plugin.version>
        <maven-javadoc-plugin.version>3.3.1</maven-javadoc-plugin.version>
        <maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
        <maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
        <maven-dependency-plugin.version>3.2.0</maven-dependency-plugin.version>
        <maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
        <maven-project-info-reports-plugin.version>3.1.2</maven-project-info-reports-plugin.version>
        <maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.12</nexus-staging-maven-plugin.version>
        <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
        <exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>
        <archetype-packaging.version>3.2.0</archetype-packaging.version>
        <maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>

    </properties>

    <modules>
        <module>${rootArtifactId}-shared</module>
        <module>${rootArtifactId}-plc-web</module>
        <module>${rootArtifactId}-web</module>
    </modules>

    <dependencyManagement>
        <dependencies>

            <!-- Base -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
                <scope>runtime</scope>
            </dependency>

            <!-- my-plc-app -->
            <dependency>
                <groupId>${groupId}</groupId>
                <artifactId>${rootArtifactId}-shared</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${groupId}</groupId>
                <artifactId>${rootArtifactId}-plc-web</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${groupId}</groupId>
                <artifactId>${rootArtifactId}-web</artifactId>
                <version>${project.version}</version>
            </dependency>

            <!-- Strolch -->
            <dependency>
                <groupId>li.strolch</groupId>
                <artifactId>strolch-bom</artifactId>
                <type>pom</type>
                <version>${strolch.version}</version>
                <scope>import</scope>
            </dependency>

            <!-- PLC -->
            <dependency>
                <groupId>li.strolch</groupId>
                <artifactId>plc-model</artifactId>
                <version>${strolch-plc.version}</version>
            </dependency>
            <dependency>
                <groupId>li.strolch</groupId>
                <artifactId>plc-core</artifactId>
                <version>${strolch-plc.version}</version>
            </dependency>
            <dependency>
                <groupId>li.strolch</groupId>
                <artifactId>plc-rest</artifactId>
                <version>${strolch-plc.version}</version>
            </dependency>
            <dependency>
                <groupId>li.strolch</groupId>
                <artifactId>plc-gw-server</artifactId>
                <version>${strolch-plc.version}</version>
            </dependency>
            <dependency>
                <groupId>li.strolch</groupId>
                <artifactId>plc-gw-client</artifactId>
                <version>${strolch-plc.version}</version>
            </dependency>
            <dependency>
                <groupId>li.strolch</groupId>
                <artifactId>plc-util</artifactId>
                <version>${strolch-plc.version}</version>
            </dependency>

            <!-- Restful API -->
            <dependency>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
                <version>${jaxb.api.version}</version>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>${serverlet.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.ws.rs</groupId>
                <artifactId>javax.ws.rs-api</artifactId>
                <version>${jaxrs.api.version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.bundles</groupId>
                <artifactId>jaxrs-ri</artifactId>
                <version>${jaxrs.ri.version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey</groupId>
                <artifactId>jersey-bom</artifactId>
                <version>${jersey.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.glassfish.tyrus</groupId>
                <artifactId>tyrus-client</artifactId>
                <version>${tyrus.version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.tyrus</groupId>
                <artifactId>tyrus-container-grizzly-client</artifactId>
                <version>${tyrus.version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.tyrus</groupId>
                <artifactId>tyrus-container-grizzly-server</artifactId>
                <version>${tyrus.version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.grizzly</groupId>
                <artifactId>grizzly-framework</artifactId>
                <version>${grizzly.version}</version>
            </dependency>

            <!-- websocket -->
            <dependency>
                <groupId>javax.websocket</groupId>
                <artifactId>javax.websocket-api</artifactId>
                <version>${websocket.version}</version>
                <scope>provided</scope>
            </dependency>

            <!-- test -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-core</artifactId>
                <version>${hamcrest.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-library</artifactId>
                <version>${hamcrest.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.properties</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/*.properties</exclude>
                </excludes>
            </resource>
        </resources>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>buildnumber-maven-plugin</artifactId>
                    <version>${buildnumber-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>validate</phase>
                            <goals>
                                <goal>create</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <doCheck>false</doCheck>
                        <doUpdate>false</doUpdate>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <showDeprecation>true</showDeprecation>
                        <showWarnings>true</showWarnings>
                        <compilerArgument>-Xlint:all</compilerArgument>
                    </configuration>
                </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-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>attach-sources-no-fork</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>${maven-site-plugin.version}</version>
                    <configuration>
                        <outputEncoding>UTF-8</outputEncoding>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar-plugin.version}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            </manifest>
                        </archive>
                    </configuration>
                </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>
                            <phase>deploy</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <!-- explicitly define maven-deploy-plugin after other to force exec
                        order -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven-deploy-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>deploy</id>
                            <phase>deploy</phase>
                            <goals>
                                <goal>deploy</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven-dependency-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>copy-dependencies</id>
                            <phase>package</phase>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${project.build.directory}/lib</outputDirectory>
                                <overWriteReleases>false</overWriteReleases>
                                <overWriteSnapshots>false</overWriteSnapshots>
                                <overWriteIfNewer>true</overWriteIfNewer>
                                <excludeTransitive>false</excludeTransitive>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>${maven-assembly-plugin.version}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addClasspath>true</addClasspath>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

    <profiles>

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

    </profiles>

</project>
