<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2018-Present The CloudEvents Authors
  ~ <p>
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~ <p>
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~ <p>
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~
  -->
<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>io.cloudevents</groupId>
    <artifactId>cloudevents-parent</artifactId>
    <version>4.0.1</version>
    <packaging>pom</packaging>

    <name>CloudEvents</name>
    <url>https://cloudevents.github.io/sdk-java/</url>
    <description>CloudEvents SDK for Java</description>

    <scm>
        <connection>scm:git:git://github.com/cloudevents/sdk-java.git</connection>
        <developerConnection>scm:git:git@github.com:cloudevents/sdk-java.git</developerConnection>
        <url>https://github.com/cloudevents/sdk-java</url>
        <tag>HEAD</tag>
    </scm>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>slinkydeveloper</id>
            <name>Francesco Guardiani</name>
        </developer>

        <developer>
            <id>matzew</id>
            <name>Matthias Wessendorf</name>
        </developer>

        <developer>
            <id>jponge</id>
            <name>Julien Ponge</name>
        </developer>

        <developer>
            <id>fabiojose</id>
            <name>Fabio José de Moraes</name>
        </developer>
    </developers>

    <modules>
        <module>api</module>
        <module>core</module>
        <module>formats/avro-compact</module>
        <module>formats/json-jackson</module>
        <module>formats/protobuf</module>
        <module>formats/xml</module>
        <module>amqp</module>
        <module>http/basic</module>
        <module>http/vertx</module>
        <module>http/restful-ws</module>
        <module>http/restful-ws-jakarta</module>
        <module>kafka</module>
        <module>spring</module>
        <module>sql</module>
        <module>bom</module>
        <module>rocketmq</module>
    </modules>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Maven plugins -->
        <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
        <maven-editorconfig-plugin.version>0.1.0</maven-editorconfig-plugin.version>

        <!-- Dependencies -->
        <assertj-core.version>3.16.1</assertj-core.version>
        <junit-jupiter.version>5.7.0</junit-jupiter.version>
    </properties>

    <distributionManagement>
        <site>
            <id>site</id>
            <url>https://cloudevents.io</url>
        </site>

        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>

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

    <build>
        <pluginManagement>
            <plugins>
                <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-jar-plugin</artifactId>
                    <configuration>
                        <archive>
                            <manifestEntries>
                                <Automatic-Module-Name>${module-name}</Automatic-Module-Name>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.ec4j.maven</groupId>
                    <artifactId>editorconfig-maven-plugin</artifactId>
                    <version>${maven-editorconfig-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>check</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <excludes>
                            <exclude>.gitignore</exclude>
                            <exclude>LICENSE</exclude>
                            <exclude>.mvn</exclude>
                        </excludes>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <!-- Javadoc jar -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <detectLinks/>
                    <links>
                        <link>https://docs.spring.io/spring-framework/docs/current/javadoc-api/</link>
                        <link>https://jakarta.ee/specifications/platform/8/apidocs/</link>
                        <link>https://kafka.apache.org/30/javadoc/</link>
                        <link>https://fasterxml.github.io/jackson-databind/javadoc/2.10/</link>
                    </links>
                    <source>8</source>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Sources jar -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Enable integration tests only when not deploying
            ~ https://stackoverflow.com/questions/25305850/how-to-disable-nexus-staging-maven-plugin-in-sub-modules
            -->
        <profile>
            <id>no-deploy</id>
            <activation>
                <property>
                    <name>!release</name>
                </property>
            </activation>
            <modules>
                <module>benchmarks</module>
                <module>http/restful-ws-integration-tests</module>
                <module>http/restful-ws-jakarta-integration-tests</module>
                <module>examples</module>
            </modules>
        </profile>

        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>

            <build>
                <plugins>
                    <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>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--batch</arg>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
