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

  <groupId>com.google.cloud.tools</groupId>
  <artifactId>appengine-plugins-core</artifactId>
  <version>0.13.2</version><!-- {x-version-update:appengine-plugins-core:current} -->

  <name>App Engine Plugins Core Library</name>
  <description>
    A library for client side software that manages App Engine programs.
  </description>
  <url>https://github.com/GoogleCloudPlatform/appengine-plugins</url>

  <organization>
    <name>Google LLC</name>
    <url>https://www.google.com</url>
  </organization>

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

  <developers>
    <developer>
      <id>joaomartins</id>
      <name>João Martins</name>
      <email>joaomartins@google.com</email>
      <organization>Google</organization>
      <organizationUrl>http://www.google.com</organizationUrl>
    </developer>
    <developer>
      <id>appu</id>
      <name>Appu Goundan</name>
      <email>appu@google.com</email>
      <organization>Google</organization>
      <organizationUrl>http://www.google.com</organizationUrl>
    </developer>
    <developer>
      <id>meltsufin</id>
      <name>Mike Eltsufin</name>
      <email>meltsufin@google.com</email>
      <organization>Google</organization>
      <organizationUrl>http://www.google.com</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/GoogleCloudPlatform/appengine-plugins.git
    </connection>
    <developerConnection>scm:git:https://github.com/GoogleCloudPlatform/appengine-plugins.git
    </developerConnection>
    <url>https://github.com/GoogleCloudPlatform/appengine-plugins</url>
  </scm>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://google.oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://google.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <!-- Errorprone check exclusions; see https://errorprone.info/docs/flags -->
    <errorprone_exclusions>com.google.cloud.tools.appengine.operations.DevServerJava8Test,com.google.cloud.tools.appengine.operations.DevServerJava9OrAboveTest,com.google.cloud.tools.appengine.operations.cloudsdk.serialization.AppEngineDeployResult,com.google.cloud.tools.io.FilePermissionsTest,com.google.cloud.tools.managedcloudsdk.install.InstallerFactoryTest,com.google.cloud.tools.appengine.AppEngineDescriptorTest,com.google.cloud.tools.appengine.operations.cloudsdk.serialization.CloudSdkVersionTest,com.google.cloud.tools.appengine.operations.GenRepoInfoFileTest,com.google.cloud.tools.appengine.operations.DeploymentTest,com.google.cloud.tools.appengine.operations.AuthTest,com.google.cloud.tools.appengine.configuration.RunConfigurationTest</errorprone_exclusions>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>32.1.2-jre</version>
      <exclusions>
        <exclusion>
          <!-- To avoid dependency convergence error with gson's errorprone -->
          <groupId>com.google.errorprone</groupId>
          <artifactId>error_prone_annotations</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
      <version>2.2</version>
    </dependency>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <version>3.0.2</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>2.11.0</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.json</artifactId>
      <version>1.1.4</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-compress</artifactId>
      <version>1.26.1</version>
    </dependency>

    <!-- test dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>5.5.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
       <groupId>org.hamcrest</groupId>
       <artifactId>hamcrest-core</artifactId>
       <version>1.3</version>
       <scope>test</scope>
    </dependency>
    <dependency>
       <groupId>org.hamcrest</groupId>
       <artifactId>hamcrest-library</artifactId>
       <version>1.3</version>
       <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.2.2</version>
        <configuration>
          <archive>
            <!-- include manifest produced by maven-bundle-plugin -->
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>

      <!-- newer surefire for excluding tests -Dtest=!ManagedCloudSdkTest -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.1.2</version>
      </plugin>

      <plugin>
        <groupId>com.coveo</groupId>
        <artifactId>fmt-maven-plugin</artifactId>
        <version>2.4.0</version>
        <!-- use fmt:format to auto format -->
        <dependencies>
          <dependency>
            <groupId>com.google.googlejavaformat</groupId>
            <artifactId>google-java-format</artifactId>
            <version>1.7</version>
          </dependency>
        </dependencies>
        <configuration>
          <displayFiles>true</displayFiles>
        </configuration>
        <executions>
          <execution>
            <phase>initialize</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>5.1.9</version>
        <configuration>
          <!--
             Register as an Eclipse Buddy to allow discovery of CloudSdkResolver
             instances from other bundles.
          -->
          <instructions>
            <Bundle-SymbolicName>com.google.cloud.tools.appengine</Bundle-SymbolicName>
            <Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment>
            <Import-Package>!javax.annotation,*</Import-Package>
            <Eclipse-BuddyPolicy>registered</Eclipse-BuddyPolicy>
            <!--  best URL we have until
                  https://github.com/GoogleCloudPlatform/appengine-plugins-core/issues/338
                  is fixed -->
            <Bundle-DocURL>https://github.com/GoogleCloudPlatform/appengine-plugins-core</Bundle-DocURL>
          </instructions>
        </configuration>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- set up surefire for JaCoCo code coverage -->
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.10</version>
        <executions>
          <execution>
            <id>initialize</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>generation</id>
            <phase>verify</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
       </plugin>

       <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M3</version>
        <dependencies>
          <dependency>
            <groupId>com.google.cloud.tools</groupId>
            <artifactId>linkage-checker-enforcer-rules</artifactId>
            <version>0.2.0</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>convergence</id>
            <phase>validate</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <dependencyConvergence />
              </rules>
            </configuration>
          </execution>
          <execution>
            <id>linkage</id>
            <!-- Important! Should run after compile -->
            <phase>verify</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <LinkageCheckerRule implementation="com.google.cloud.tools.dependencies.enforcer.LinkageCheckerRule">
                  <level>WARN</level>
                </LinkageCheckerRule>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>java9_and_up</id>
      <activation>
        <jdk>[9,]</jdk>
      </activation>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.11.0</version>
            <configuration>
              <!-- For Java 8, the plugin is overridden below, without errorprone -->
              <source>1.8</source>
              <target>1.8</target>
              <showDeprecation>true</showDeprecation>
              <showWarnings>true</showWarnings>
              <annotationProcessorPaths>
                <path>
                  <groupId>com.google.errorprone</groupId>
                  <artifactId>error_prone_core</artifactId>
                  <version>2.29.2</version>
                </path>
                <path>
                  <groupId>com.uber.nullaway</groupId>
                  <artifactId>nullaway</artifactId>
                  <version>0.10.14</version>
                </path>
              </annotationProcessorPaths>
              <fork>true</fork>
              <compilerArgs>
                <arg>-XDcompilePolicy=simple</arg>
                <arg>-Xplugin:ErrorProne -Xep:NullAway:ERROR -XepOpt:NullAway:AnnotatedPackages=com.google.cloud.tools -XepOpt:NullAway:KnownInitializers=com.google.gson.Gson.fromJson -XepOpt:NullAway:ExcludedFieldAnnotations=org.mockito.Mock,org.junit.runners.Parameterized -XepOpt:NullAway:ExcludedClasses=${errorprone_exclusions}</arg>
                <!-- Errorprone requires opening up some JDK modules.
                     See https://errorprone.info/docs/installation#maven for details
                -->
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
              </compilerArgs>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
    <id>dev</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>ManagedCloudSdkTest.java</exclude>
                <exclude>LibrariesTest.java</exclude>
              </excludes>
            </configuration>
          </plugin>
          <plugin>
            <groupId>com.coveo</groupId>
            <artifactId>fmt-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>auto-format-dev</id>
                <phase>validate</phase>
                <goals>
                  <goal>format</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <!-- Release to Sonatype (Maven Central) needs nexus-staging-maven-plugin but OSS Exit Gate
          does not require nexus-staging-maven-plugin -->
      <id>nexus-staging-plugin</id>
      <activation>
        <property>
          <name>performRelease</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.13</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>sonatype-nexus-staging</serverId>
              <nexusUrl>https://google.oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>false</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <activation>
        <property>
          <name>performRelease</name>
        </property>
      </activation>
      <build>
        <plugins>
          <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>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.3.2</version>
            <configuration>
              <additionalparam>-Xdoclint:none</additionalparam>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <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>
    </profile>

    <profile>
      <id>jdk8</id>
      <activation>
        <jdk>1.8</jdk>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.mockito</groupId>
          <artifactId>mockito-core</artifactId>
          <!-- keep 4.x for JDK 8 tests as 5.x is for JDK 11+ -->
          <version>4.11.0</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>m2e-only</id>
      <activation>
        <property>
          <name>m2e.version</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <!-- for development support in Eclipse IDE -->
            <plugin>
              <groupId>org.eclipse.m2e</groupId>
              <artifactId>lifecycle-mapping</artifactId>
              <version>1.0.0</version>
              <configuration>
                <lifecycleMappingMetadata>
                  <pluginExecutions>
                    <!-- m2eclipse does not support errorprone -->
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <versionRange>[3.3,)</versionRange>
                        <goals>
                          <goal>compile</goal>
                          <goal>testCompile</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <configurator>
                          <id>org.eclipse.m2e.jdt.javaConfigurator</id>
                        </configurator>
                      </action>
                    </pluginExecution>
                    <!-- m2e does not support fmt-maven-plugin -->
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>com.coveo</groupId>
                        <artifactId>fmt-maven-plugin</artifactId>
                        <versionRange>[0.0,)</versionRange>
                        <goals>
                          <goal>check</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <execute>
                          <runOnIncremental>true</runOnIncremental>
                        </execute>
                      </action>
                    </pluginExecution>
                  </pluginExecutions>
                </lifecycleMappingMetadata>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

    <profile>
      <!-- Only run checkstyle plugin on Java 11+ (checkstyle artifact only supports Java 11+) -->
      <id>checkstyle-tests</id>
      <activation>
        <jdk>[1.11,)</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>3.3.0</version>
            <dependencies>
              <dependency>
                <groupId>com.puppycrawl.tools</groupId>
                <artifactId>checkstyle</artifactId>
                <version>10.12.3</version>
              </dependency>
            </dependencies>
            <configuration>
              <consoleOutput>false</consoleOutput>
              <failOnViolation>true</failOnViolation>
              <violationSeverity>warning</violationSeverity>
              <configLocation>google_checks.xml</configLocation>
              <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
            </configuration>
            <executions>
              <execution>
                <phase>verify</phase>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>aoss</id>
      <repositories>
        <repository>
          <id>aoss-artifact-registry</id>
          <name>AOSS Repository</name>
          <url>artifactregistry://us-maven.pkg.dev/cloud-aoss-1p/cloud-aoss-1p-java</url>
        </repository>
      </repositories>
    </profile>
    <profile>
      <id>exitgate-artifact-registry-publishing</id>
      <distributionManagement>
        <repository>
          <id>gcp-artifact-registry-maven-plugin-releases</id>
          <url>artifactregistry://us-maven.pkg.dev/oss-exit-gate-prod/appengine-plugins-core--com-google-cloud-tools--maven-central</url>
        </repository>
      </distributionManagement>
    </profile>
  </profiles>
</project>
