<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <!-- Attention! We need to keep this in sync with the spring-boot version set in sip-framework,
             which is transitively referenced in sip-integration-starter specified in the dependencymanagement section -->
        <version>3.4.8</version>
    <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>one.x1f.sip.foundation</groupId>
    <artifactId>sip-starter-parent</artifactId>
    <version>4.0.0</version>
    <packaging>pom</packaging>
    <name>SIP Starter Parent</name>
    <description>Parent pom providing dependency and plugin management for SIP integration adapters built with Maven
    </description>
    <url>https://github.com/IKOR-GmbH/sip-framework</url>

    <scm>
        <connection>scm:git:git://github.com/IKOR-GmbH/sip-framework.git</connection>
        <developerConnection>scm:git:ssh:IKOR-GmbH/sip-framework.git</developerConnection>
        <url>https://github.com/IKOR-GmbH/sip-framework/tree/main</url>
    </scm>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>https://raw.githubusercontent.com/IKOR-GmbH/sip-framework/develop/LICENSE.md</url>
        </license>
    </licenses>

    <organization>
        <name>x1F GmbH</name>
        <url>https://x1f.one</url>
    </organization>

    <developers>
        <developer>
            <name>SIP Development Team</name>
            <email>sip@x1f.one</email>
            <organization>x1F GmbH</organization>
            <organizationUrl>https://x1f.one/</organizationUrl>
        </developer>
    </developers>

    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/IKOR-GmbH/sip-framework/issues</url>
    </issueManagement>

    <properties>
        <java.version>17</java.version>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>

        <sip-framework.version>4.0.0</sip-framework.version>               <!-- keep in sync with framework version -->
        <mapstruct.version>1.5.5.Final</mapstruct.version>                          <!-- keep in sync with mapstruct version in framework pom -->
        <lombok.version>1.18.38</lombok.version>                                    <!-- keep in sync with lombok version in framework pom -->
        <cxf.version>4.1.1</cxf.version>                                            <!-- keep in sync with cxf version in framework pom -->
        <snakeyaml.version>2.4</snakeyaml.version>                                  <!-- keep in sync with snakeyaml version in framework pom -->
        <lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version>
        <maven-gpg-plugin.version>3.2.6</maven-gpg-plugin.version>                  <!-- keep in sync with framework, for maven central deployment -->
        <sonatype-central-publishing-plugin.version>0.8.0</sonatype-central-publishing-plugin.version>  <!-- keep in sync with framework, for maven central deployment -->
        <spotless-maven-plugin.version>2.46.1</spotless-maven-plugin.version>       <!-- keep in sync with spotless version in framework pom -->
        <apache-commons-lang3.version>3.18.0</apache-commons-lang3.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>one.x1f.sip.foundation</groupId>
            <artifactId>sip-integration-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel.springboot</groupId>
            <artifactId>camel-servlet-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel.springboot</groupId>
            <artifactId>camel-openapi-java-starter</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>io.swagger.core.v3</groupId>
                    <artifactId>swagger-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.swagger.parser.v3</groupId>
                    <artifactId>swagger-parser-v3</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.swagger.parser.v3</groupId>
                    <artifactId>swagger-parser</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel.springboot</groupId>
            <artifactId>camel-http-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel.springboot</groupId>
            <artifactId>camel-bindy-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel.springboot</groupId>
            <artifactId>camel-bean-validator-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
            <version>${mapstruct.version}</version>
        </dependency>
        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>${snakeyaml.version}</version>
        </dependency>

        <!-- runtime dependencies -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <!-- test dependencies -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>one.x1f.sip.foundation</groupId>
                <artifactId>sip-framework</artifactId>
                <version>${sip-framework.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${apache-commons-lang3.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>one.x1f.sip.foundation</groupId>
                    <artifactId>sip-maven-plugin</artifactId>
                    <version>${sip-framework.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>connectors-cross-dependencies-check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-codegen-plugin</artifactId>
                    <version>${cxf.version}</version>
                    <executions>
                        <execution>
                            <id>generate-sources</id>
                            <phase>generate-sources</phase>
                            <configuration>
                                <sourceRoot>${project.build.directory}/generated-sources/wsdlimport</sourceRoot>
                                <wsdlRoot>${basedir}/src/main/resources</wsdlRoot>
                                <includes>
                                    <include>**/*.wsdl</include>
                                </includes>
                            </configuration>
                            <goals>
                                <goal>wsdl2java</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless-maven-plugin.version}</version>
                <configuration>
                    <java>
                        <googleJavaFormat/>
                    </java>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>package-deployment</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${sonatype-central-publishing-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>maven-central</publishingServerId>
                            <ignorePublishedComponents>true</ignorePublishedComponents>
                            <autoPublish>true</autoPublish>
                            <waitUntil>validated</waitUntil>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
