<?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.jenkins-ci.main</groupId>
    <artifactId>jenkins-parent</artifactId>
    <version>2.492.1</version>
  </parent>

  <artifactId>cli</artifactId>

  <name>Jenkins cli</name>
  <description>Command line interface for Jenkins</description>
  <url>https://github.com/jenkinsci/jenkins</url>

  <properties>
    <mina-sshd.version>2.14.0</mina-sshd.version>
    <!-- Filled in by jacoco-maven-plugin -->
    <jacocoSurefireArgs />
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jenkins-ci.main</groupId>
        <artifactId>jenkins-bom</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <!-- ed25519 algorithm, see JENKINS-45318 -->
      <groupId>net.i2p.crypto</groupId>
      <artifactId>eddsa</artifactId>
      <version>0.3.0</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.apache.sshd</groupId>
      <artifactId>sshd-common</artifactId>
      <version>${mina-sshd.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.apache.sshd</groupId>
      <artifactId>sshd-core</artifactId>
      <version>${mina-sshd.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.glassfish.tyrus.bundles</groupId>
      <artifactId>tyrus-standalone-client-jdk</artifactId>
      <version>2.2.0</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci</groupId>
      <artifactId>annotation-indexer</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.jvnet.localizer</groupId>
      <artifactId>localizer</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>com.github.spotbugs</groupId>
      <artifactId>spotbugs-annotations</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>com.google.code.findbugs</groupId>
          <artifactId>jsr305</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.kohsuke</groupId>
      <artifactId>access-modifier-annotation</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <!-- Version specified in grandparent POM -->
        <configuration>
          <argLine>@{jacocoSurefireArgs}</argLine>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.6.0</version>
        <executions>
          <execution>
            <goals>
              <goal>shade</goal>
            </goals>
            <phase>package</phase>
            <configuration>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <relocations>
                <relocation>
                  <pattern>org</pattern>
                  <shadedPattern>io.jenkins.cli.shaded.org</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>net</pattern>
                  <shadedPattern>io.jenkins.cli.shaded.net</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com</pattern>
                  <shadedPattern>io.jenkins.cli.shaded.com</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>jakarta</pattern>
                  <shadedPattern>io.jenkins.cli.shaded.jakarta</shadedPattern>
                </relocation>
              </relocations>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>hudson.cli.CLI</mainClass>
                  <manifestEntries>
                    <Jenkins-CLI-Version>${project.version}</Jenkins-CLI-Version>
                  </manifestEntries>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jvnet.localizer</groupId>
        <artifactId>localizer-maven-plugin</artifactId>
        <!-- version specified in grandparent pom -->
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <fileMask>Messages.properties</fileMask>
              <outputDirectory>target/generated-sources/localizer</outputDirectory>
              <accessModifierAnnotations>true</accessModifierAnnotations>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <!-- Version specified in grandparent POM -->
        <executions>
          <execution>
            <id>add-source</id>
            <goals>
              <goal>add-source</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/localizer</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>enable-jacoco</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <!-- Version specified in parent POM -->
            <executions>
              <execution>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
                <configuration>
                  <propertyName>jacocoSurefireArgs</propertyName>
                  <includes>
                    <include>hudson/*</include>
                    <include>hudson/**/*</include>
                    <include>jenkins/*</include>
                    <include>jenkins/**/*</include>
                    <include>org/jenkins/**/*</include>
                  </includes>
                  <excludes>
                    <exclude>**/Messages.class</exclude>
                  </excludes>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
