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

  <parent>
    <groupId>org.camunda</groupId>
    <artifactId>camunda-release-parent</artifactId>
    <version>3.9.1</version>
    <!-- do not remove empty tag - http://jira.codehaus.org/browse/MNG-4687 -->
    <relativePath/>
  </parent>

  <groupId>io.camunda.connector</groupId>
  <artifactId>connector-parent</artifactId>
  <version>0.1.0</version>
  <packaging>pom</packaging>

  <name>Camunda Connector Parent</name>
  <description>${project.name}</description>
  <inceptionYear>2022</inceptionYear>

  <scm>
    <connection>scm:git:git@github.com:camunda/connector-framework.git</connection>
    <developerConnection>scm:git:git@github.com:camunda/connector-framework.git</developerConnection>
    <tag>HEAD</tag>
    <url>https://github.com/camunda/connector-framework</url>
  </scm>

  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/camunda/connector-framework/issues</url>
  </issueManagement>
  
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <properties>
    <version.java>11</version.java>

    <!-- an inline header will allow usage in downstream connectors -->
    <license.inlineheader>Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information regarding copyright
ownership. Camunda licenses this file to you under the Apache License,
Version 2.0; you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

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.</license.inlineheader>

    <!-- release parent settings -->
    <nexus.snapshot.repository>https://artifacts.camunda.com/artifactory/connectors-snapshots/</nexus.snapshot.repository>
    <nexus.release.repository>https://artifacts.camunda.com/artifactory/connectors/</nexus.release.repository>
    <nexus.sonatype.url>https://s01.oss.sonatype.org</nexus.sonatype.url>

    <!-- external libraries -->
    <version.slf4j>1.7.36</version.slf4j>
    <version.zeebe>8.0.3</version.zeebe>
    <version.gson>2.9.0</version.gson>
    <version.mockito>4.6.1</version.mockito>
    <version.junit-jupiter>5.8.2</version.junit-jupiter>
    <version.assertj>3.23.1</version.assertj>

    <!-- maven plugins (not managed by parent) -->
    <plugin.version.function-maven-plugin>0.10.0</plugin.version.function-maven-plugin>
    <plugin.version.maven-enforcer-plugin>3.1.0</plugin.version.maven-enforcer-plugin>
    <plugin.version.maven-install-plugin>3.0.0-M1</plugin.version.maven-install-plugin>
    <plugin.version.license>4.1</plugin.version.license>
    <plugin.version.maven-resources-plugin>3.2.0</plugin.version.maven-resources-plugin>
    <plugin.version.maven-shade-plugin>3.3.0</plugin.version.maven-shade-plugin>
    <plugin.version.maven-surefire-plugin>3.0.0-M7</plugin.version.maven-surefire-plugin>
    <plugin.version.spotless-maven-plugin>2.22.8</plugin.version.spotless-maven-plugin>
  </properties>

  <dependencyManagement>
    <dependencies>
      <!-- Camunda internal dependencies -->
      <dependency>
        <groupId>io.camunda.connector</groupId>
        <artifactId>connector-core</artifactId>
        <version>0.1.0</version>
      </dependency>

      <dependency>
        <groupId>io.camunda</groupId>
        <artifactId>zeebe-client-java</artifactId>
        <version>${version.zeebe}</version>
      </dependency>
      
      <!-- Third party dependencies -->
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${version.slf4j}</version>
      </dependency>
      
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-jdk14</artifactId>
        <version>${version.slf4j}</version>
      </dependency>

      <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>${version.gson}</version>
      </dependency>

      <!-- test dependencies -->
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>${version.junit-jupiter}</version>
        <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>${version.mockito}</version>
        <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>${version.mockito}</version>
        <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${version.assertj}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>${plugin.version.maven-install-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>${plugin.version.maven-shade-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${plugin.version.maven-surefire-plugin}</version>
          <configuration>
            <redirectTestOutputToFile>true</redirectTestOutputToFile>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${plugin.version.maven-enforcer-plugin}</version>
          <configuration>
            <rules>
              <!--
                <dependencyConvergence />
              -->
              <requirePluginVersion/>
            </rules>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>enforce</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>${plugin.version.spotless-maven-plugin}</version>
          <configuration>
            <formats>
              <format>
                <includes>
                  <include>*.md</include>
                  <include>.gitignore</include>
                </includes>
                <trimTrailingWhitespace/>
                <endWithNewline/>
                <indent>
                  <spaces>true</spaces>
                  <spacesPerTab>2</spacesPerTab>
                </indent>
              </format>
            </formats>
            <java>
              <googleJavaFormat/>
            </java>
            <pom/>
          </configuration>
        </plugin>
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>${plugin.version.license}</version>
          <configuration>
            <properties>
              <owner>camunda services GmbH</owner>
              <email>info@camunda.com</email>
            </properties>
            <mapping>
              <java>SLASHSTAR_STYLE</java>
            </mapping>
            <skipExistingHeaders>false</skipExistingHeaders>
            <licenseSets>
              <licenseSet>
                <inlineHeader>${license.inlineheader}</inlineHeader>
                <includes>
                  <include>**/*.java</include>
                </includes>
              </licenseSet>
            </licenseSets>
          </configuration>
        </plugin>
        <plugin>
          <groupId>com.google.cloud.functions</groupId>
          <artifactId>function-maven-plugin</artifactId>
          <version>${plugin.version.function-maven-plugin}</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!-- profile to auto format -->
    <profile>
      <id>autoFormat</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>spotless-format</id>
                <goals>
                  <goal>apply</goal>
                </goals>
                <phase>process-sources</phase>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>add-license</id>
                <goals>
                  <goal>format</goal>
                </goals>
                <phase>process-sources</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- profile to perform strict validation checks -->
    <profile>
      <id>checkFormat</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>spotless-check</id>
                <goals>
                  <goal>check</goal>
                </goals>
                <phase>validate</phase>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>check-license</id>
                <goals>
                  <goal>check</goal>
                </goals>
                <phase>validate</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>sonatype-oss-release</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-gpg-plugin</artifactId>
              <configuration>
                <gpgArguments>
                  <arg>--pinentry-mode</arg>
                  <arg>loopback</arg>
                </gpgArguments>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>

</project>
