<?xml version="1.0" encoding="UTF-8"?>
<!--
 ~ The MIT License
 ~
 ~ Copyright (c) 2016, CloudBees, Inc.
 ~
 ~ Permission is hereby granted, free of charge, to any person obtaining a copy
 ~ of this software and associated documentation files (the "Software"), to deal
 ~ in the Software without restriction, including without limitation the rights
 ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 ~ copies of the Software, and to permit persons to whom the Software is
 ~ furnished to do so, subject to the following conditions:
 ~
 ~ The above copyright notice and this permission notice shall be included in
 ~ all copies or substantial portions of the Software.
 ~
 ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 ~ THE SOFTWARE.
 -->

<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>org.jenkins-ci.plugins</groupId>
  <artifactId>plugin</artifactId>
  <version>3.2</version>
  <packaging>pom</packaging>

  <name>Jenkins Plugin Parent POM</name>
  <description>The Jenkins Plugins Parent POM Project</description>
  <inceptionYear>2016</inceptionYear>

  <scm>
    <connection>scm:git:ssh://git@github.com/jenkinsci/plugin-pom.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/jenkinsci/plugin-pom.git</developerConnection>
    <tag>plugin-3.2</tag>
  </scm>

  <properties>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <project.build.outputEncoding>UTF-8</project.build.outputEncoding>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <releaseProfiles> </releaseProfiles>
    <arguments> </arguments>
    <argLine>-Xmx768M -Djava.awt.headless=true</argLine>
    <jenkins.version>2.60.1</jenkins.version>
    <!-- Should only need to override these if using timestamped snapshots: -->
    <jenkins-core.version>${jenkins.version}</jenkins-core.version>
    <jenkins-war.version>${jenkins.version}</jenkins-war.version>
    <jenkins-test-harness.version>2.32</jenkins-test-harness.version>
    <hpi-plugin.version>2.1</hpi-plugin.version>
    <stapler-plugin.version>1.17</stapler-plugin.version>
    <java.level>you-must-override-the-java.level-property</java.level>
    <!-- Change this property if you need your tests to be compiled with a different Java level than the plugin. -->
    <!-- Use only if strictly necessary. It may cause problems in your IDE. -->
    <java.level.test>${java.level}</java.level.test>
    <concurrency>1</concurrency> <!-- DEPRECATED use forkCount -->
    <forkCount>${concurrency}</forkCount> <!-- may use e.g. 2C for 2 × (number of cores) -->
    <trimStackTrace>false</trimStackTrace> <!-- SUREFIRE-1226 workaround -->
    <!-- Whether the build should fail if findbugs finds any error. -->
    <!-- It is strongly encouraged to leave it as true. Use false with care only in transient situations. -->
    <findbugs.failOnError>true</findbugs.failOnError>
    <!-- Whether to skip tests during release phase (they are executed in the prepare phase). -->
    <release.skipTests>true</release.skipTests>
    <!-- By default we do not create *-tests.jar. Set to false to allow other plugins to depend on test utilities in yours, using <classifier>tests</classifier>. -->
    <no-test-jar>true</no-test-jar>
    <!-- same version as in org.jenkins-ci.main:pom -->
    <!-- TODO see if we can remove this properties -->
    <!--
      Change to "javadoc-no-fork" locally if the plugin build is running some plugins twice. This has
      been seen with some plugins configured to execute in the "initialise" phase (e.g. the enforcer plugin + frontend node/npm install).
      Note however that "javadoc-no-fork" has been known to have memory leak issues, so beware.
    -->
    <javadoc.exec.goal>javadoc</javadoc.exec.goal>

    <slf4jVersion>1.7.25</slf4jVersion>
    <node.version>4.0.0</node.version>
    <npm.version>2.13.1</npm.version>
    <yarn.version>0.23.0</yarn.version>
    <frontend-version>1.4</frontend-version>
    <skip.node.tests /> <!-- changed by -DskipTests, if specified - see profile -->
    <skip.node.lint /> <!-- changed by -DskipLint, if specified - see profile -->
    <npm.loglevel /> <!-- may use e.g. -\-silent (without backslash) -->
    <!-- For jgit-scm-provider profile -->
    <git.provider>git</git.provider>
    <maven-scm.version>1.9.5</maven-scm.version>
    <!-- To skip the wizard by default in hpi:run. It should not impact other goals. -->
    <hudson.Main.development>true</hudson.Main.development>
  </properties>

  <dependencyManagement>
    <dependencies>
      <!-- static analysis -->
      <dependency>
        <groupId>com.google.code.findbugs</groupId>
        <artifactId>annotations</artifactId>
        <version>3.0.0</version>
      </dependency>
      <dependency>
        <groupId>net.jcip</groupId>
        <artifactId>jcip-annotations</artifactId>
        <version>1.0</version>
      </dependency>
      <dependency>
        <groupId>org.jenkins-ci.main</groupId>
        <artifactId>jenkins-core</artifactId>
        <version>${jenkins-core.version}</version>
      </dependency>
      <dependency>
        <groupId>org.jenkins-ci.main</groupId>
        <artifactId>jenkins-war</artifactId>
        <version>${jenkins-war.version}</version>
        <type>executable-war</type>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.jenkins-ci.main</groupId>
        <artifactId>jenkins-test-harness</artifactId>
        <version>${jenkins-test-harness.version}</version>
      </dependency>
      <dependency>
        <groupId>org.jenkins-ci</groupId>
        <artifactId>test-annotations</artifactId>
        <version>1.2</version>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
      </dependency>
      <dependency> <!-- used in JTH and jenkins core > 2.x -->
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
      </dependency>
      <dependency>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>animal-sniffer-annotations</artifactId>
        <version>1.14</version>
      </dependency>
      <dependency>
        <groupId>org.codehaus.mojo.signature</groupId>
        <artifactId>java15</artifactId>
        <version>1.0</version>
        <type>signature</type>
      </dependency>
      <dependency>
        <groupId>org.codehaus.mojo.signature</groupId>
        <artifactId>java16</artifactId>
        <version>1.1</version>
        <type>signature</type>
      </dependency>
      <dependency>
        <groupId>org.codehaus.mojo.signature</groupId>
        <artifactId>java17</artifactId>
        <version>1.0</version>
        <type>signature</type>
      </dependency>
      <dependency>
        <groupId>org.codehaus.mojo.signature</groupId>
        <artifactId>java18</artifactId>
        <version>1.0</version>
        <type>signature</type>
      </dependency>
      <!-- mark logging dependencies as provided by war -->
      <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.2</version>
        <scope>provided</scope><!-- by jcl-over-slf4j -->
      </dependency>
      <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
        <scope>provided</scope><!-- by log4j-over-slf4j -->
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <!-- static analysis -->
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>annotations</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>net.jcip</groupId>
      <artifactId>jcip-annotations</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <!-- for JRE requirement check annotation -->
    <dependency>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>animal-sniffer-annotations</artifactId>
      <scope>provided</scope>
      <optional>true</optional><!-- no need to have this at runtime -->
    </dependency>
    <!-- dependencies provided by virtue of running in Jenkins -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.main</groupId>
      <artifactId>jenkins-core</artifactId>
      <scope>provided</scope>
    </dependency>
    <!-- dependencies needed for testing -->
    <dependency>
      <groupId>org.jenkins-ci.main</groupId>
      <artifactId>jenkins-war</artifactId>
      <type>executable-war</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.main</groupId>
      <artifactId>jenkins-test-harness</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>junit</groupId>
          <artifactId>junit-dep</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci</groupId>
      <artifactId>test-annotations</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4jVersion}</version>
      <scope>compile</scope>
      <!-- mark the API as optional so it is not packaged in the HPI but available during compile -->
      <optional>true</optional>
    </dependency>
    <!-- make slf4j bindings to java.util.logging available during tests -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>log4j-over-slf4j</artifactId>
      <version>${slf4jVersion}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <version>${slf4jVersion}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <version>${slf4jVersion}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <!--
      Since new versions need to overwrite old versions, it's better
      not to have version number in the .hpi file name.
    -->
    <finalName>${project.artifactId}</finalName>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.6.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.0.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.0.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.20</version>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>2.19.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.0.0-M1</version> <!-- TODO 3.0.0 when released -->
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.10.4</version>
          <configuration>
            <quiet>true</quiet>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.6</version>
        </plugin>
        <plugin>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.0.1</version>
          <configuration>
            <excludes>
              <exclude>InjectedTest.java</exclude>
            </excludes>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-war-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>findbugs-maven-plugin</artifactId>
          <version>3.0.5</version>
        </plugin>
        <plugin>
          <artifactId>maven-eclipse-plugin</artifactId>
          <version>2.10</version>
          <!--
            Because Eclipse lacks JSR-269 support, put the output
            to a different directory
          -->
          <configuration>
            <buildOutputDirectory>target/eclipse-classes</buildOutputDirectory>
            <additionalProjectnatures>
              <!-- enable Groovy nature by default for DSLD support  -->
              <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>
            </additionalProjectnatures>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.codehaus.gmaven</groupId>
          <artifactId>gmaven-plugin</artifactId>
          <version>1.5-jenkins-3</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>3.0.0</version>
          <executions>
            <execution>
              <id>add-source</id>
              <phase>generate-sources</phase>
              <goals>
                <goal>add-source</goal>
              </goals>
              <configuration>
                <sources>
                  <source>${project.build.directory}/generated-sources/localizer</source>
                </sources>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.7.9</version>
        </plugin>
        <plugin>
          <groupId>org.kohsuke.gmaven</groupId>
          <artifactId>gmaven-plugin</artifactId>
          <version>1.0-rc-5-patch-2</version>
        </plugin>
        <plugin>
          <groupId>org.kohsuke.stapler</groupId>
          <artifactId>maven-stapler-plugin</artifactId>
          <version>${stapler-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.jenkins-ci.tools</groupId>
          <artifactId>maven-hpi-plugin</artifactId>
          <version>${hpi-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>animal-sniffer-maven-plugin</artifactId>
          <version>1.15</version>
        </plugin>
        <plugin>
          <groupId>org.jvnet.localizer</groupId>
          <artifactId>maven-localizer-plugin</artifactId>
          <version>1.24</version>
        </plugin>
        <plugin>
          <groupId>org.kohsuke</groupId>
          <artifactId>access-modifier-checker</artifactId>
          <version>1.8</version>
        </plugin>
        <plugin>
          <groupId>com.cloudbees</groupId>
          <artifactId>maven-license-plugin</artifactId>
          <version>1.7</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>maybe-test-jar</id>
            <goals>
              <goal>test-jar</goal>
            </goals>
            <configuration>
              <excludes>
                <exclude>the.hpl</exclude>
                <exclude>InjectedTest.class</exclude>
                <exclude>test-dependencies/</exclude>
              </excludes>
              <skip>${no-test-jar}</skip>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>display-info</id>
            <phase>validate</phase>
            <goals>
              <goal>display-info</goal>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>[3.1.0,)</version>
                  <message>3.1.0 required by frontend-maven-plugin at least.</message>
                </requireMavenVersion>
                <requireJavaVersion>
                  <version>[1.8.0,)</version>
                </requireJavaVersion>
                <requirePluginVersions>
                  <banSnapshots>false</banSnapshots>
                </requirePluginVersions>
                <enforceBytecodeVersion>
                  <maxJdkVersion>1.${java.level}</maxJdkVersion>
                  <ignoredScopes>
                    <ignoredScope>test</ignoredScope>
                  </ignoredScopes>
                  <excludes>
                    <!-- Makes no sense to check core itself: -->
                    <exclude>org.jenkins-ci.main:jenkins-core</exclude>
                    <exclude>org.jenkins-ci.main:cli</exclude>
                    <exclude>org.jenkins-ci.main:jenkins-test-harness</exclude>
                    <exclude>org.jenkins-ci.main:remoting</exclude>
                    <exclude>org.kohsuke.stapler:stapler</exclude>
                    <exclude>org.kohsuke.stapler:stapler-groovy</exclude>
                    <exclude>org.kohsuke.stapler:stapler-jelly</exclude>
                    <exclude>org.kohsuke.stapler:stapler-jrebel</exclude>
                    <!--  findbugs dep managed to provided and optional so is not shipped and missing annotations ok -->
                    <exclude>com.google.code.findbugs:annotations</exclude>
                  </excludes>
                  <!-- To add exclusions in a Jenkins plugin, use:
                  <plugin>
                      <artifactId>maven-enforcer-plugin</artifactId>
                      <executions>
                          <execution>
                              <id>display-info</id>
                              <configuration>
                                  <rules>
                                      <enforceBytecodeVersion>
                                          <excludes combine.children="append">
                                              <exclude>…</exclude>
                                          </excludes>
                                      </enforceBytecodeVersion>
                                  </rules>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>
                  (or just override java.level) -->
                </enforceBytecodeVersion>
                <bannedDependencies>
                  <excludes>
                    <exclude>javax.servlet:servlet-api</exclude>
                    <exclude>org.sonatype.sisu:sisu-guice</exclude>
                    <exclude>log4j:log4j:*:jar:compile</exclude>
                    <exclude>log4j:log4j:*:jar:runtime</exclude>
                    <exclude>commons-logging:commons-logging:*:jar:compile</exclude>
                    <exclude>commons-logging:commons-logging:*:jar:runtime</exclude>
                  </excludes>
                </bannedDependencies>
                <requireReleaseDeps>
                  <message>No Snapshots Allowed For Release Versions</message>
                  <onlyWhenRelease>true</onlyWhenRelease>
                </requireReleaseDeps>
                <requireUpperBoundDeps>
                  <excludes>
                    <exclude>com.google.guava:guava</exclude> <!-- TODO needed for Jenkins 2.71 and earlier -->
                    <exclude>commons-logging:commons-logging</exclude> <!-- ditto -->
                    <exclude>com.google.code.findbugs:jsr305</exclude> <!-- ditto -->
                    <exclude>org.kohsuke:access-modifier-annotation</exclude> <!-- needed between Jenkins 2.36—2.60 -->
                    <exclude>net.java.dev.jna:jna</exclude> <!-- needed for Jenkins 1.585 and earlier -->
                  </excludes>
                </requireUpperBoundDeps>
              </rules>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>extra-enforcer-rules</artifactId>
            <version>1.0-beta-4</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <configuration>
          <failOnError>${findbugs.failOnError}</failOnError>
        </configuration>
        <executions>
          <execution>
            <id>findbugs</id>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>verify</phase>
            <configuration>
              <!--  Do not define excludeFilterFile here as it will force a plugin to provide a file -->
              <!--  Instead we configure this in a profile -->
              <xmlOutput>true</xmlOutput>
              <findbugsXmlOutput>false</findbugsXmlOutput>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.${java.level}</source>
          <target>1.${java.level}</target>
          <testSource>1.${java.level.test}</testSource>
          <testTarget>1.${java.level.test}</testTarget>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>animal-sniffer-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
            <id>check</id>
          </execution>
        </executions>
        <configuration>
          <signature>
            <groupId>org.codehaus.mojo.signature</groupId>
            <artifactId>java1${java.level}</artifactId>
          </signature>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-eclipse-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.jenkins-ci.tools</groupId>
        <artifactId>maven-hpi-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <showDeprecation>true</showDeprecation>
          <contextPath>/jenkins</contextPath>
          <!-- TODO specify ${java.level} when JENKINS-20679 implemented -->
          <systemProperties>
            <hudson.Main.development>${hudson.Main.development}</hudson.Main.development>
          </systemProperties>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.kohsuke.stapler</groupId>
        <artifactId>maven-stapler-plugin</artifactId>
        <extensions>true</extensions>
      </plugin>
      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <mavenExecutorId>forked-path</mavenExecutorId>
          <useReleaseProfile>false</useReleaseProfile>
          <preparationGoals>clean install</preparationGoals>
          <goals>deploy</goals>
          <arguments>${arguments}</arguments>
          <releaseProfiles>jenkins-release,${releaseProfiles}</releaseProfiles>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jvnet.localizer</groupId>
        <artifactId>maven-localizer-plugin</artifactId>
        <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>
      <!-- Will skip execution when tests are skipped. -->
      <!-- See skip-javadoc-with-tests profile below. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>${javadoc.exec.goal}</goal>
            </goals>
            <!-- As soon as possible but after required generate-sources phase -->
            <phase>process-sources</phase>
            <configuration>
              <links>
                <link>http://javadoc.jenkins.io/</link>
              </links>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.kohsuke</groupId>
        <artifactId>access-modifier-checker</artifactId>
      </plugin>
      <plugin>
        <groupId>org.codehaus.gmaven</groupId>
        <artifactId>gmaven-plugin</artifactId>
        <executions>
          <execution>
            <id>test-in-groovy</id>
            <goals>
              <goal>generateTestStubs</goal>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>ant</groupId>
            <artifactId>ant</artifactId>
            <version>1.6.5</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemProperties>
            <property>
              <name>hudson.udp</name>
              <value>-1</value>
            </property>
          </systemProperties>
          <runOrder>alphabetical</runOrder>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.cloudbees</groupId>
        <artifactId>maven-license-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>process</goal>
            </goals>
            <phase>prepare-package</phase>
            <configuration>
              <!--requireCompleteLicenseInfo>true</requireCompleteLicenseInfo-->
              <generateLicenseXml>target/${project.artifactId}/WEB-INF/licenses.xml</generateLicenseXml>
              <inlineScript><![CDATA[
                filter {
                    def plugins = [] as Set
                    
                    // collect all Jenkins plugins
                    models.entrySet().each { e ->
                        if (e.value.packaging=="hpi")
                            plugins.add(e.key.id)
                    }
                    
                    // filter out dependencies that don't belong to this plugin
                    models.entrySet().removeAll(models.entrySet().findAll { e ->
                        def a = e.key;
                        
                        if (a.dependencyTrail.size()>0 && plugins.contains(a.dependencyTrail[1]))
                            return true; // ignore transitive dependencies through other plugins

                        // if the dependency goes through jenkins core, we don't need to bundle it in the war
                        // because jenkins-core comes in the <provided> scope, I think this is a bug in Maven that it puts such
                        // dependencies into the artifact list.
                        if (a.dependencyTrail.find { trail -> trail.contains(":hudson-core:") || trail.contains(":jenkins-core:") })
                            return true;
                            
                        return false;
                    })
                }              
              ]]></inlineScript>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <id>repo.jenkins-ci.org</id>
      <url>https://repo.jenkins-ci.org/public/</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>repo.jenkins-ci.org</id>
      <url>https://repo.jenkins-ci.org/public/</url>
    </pluginRepository>
  </pluginRepositories>

  <distributionManagement>
    <repository>
      <uniqueVersion>false</uniqueVersion>
      <id>maven.jenkins-ci.org</id>
      <url>https://repo.jenkins-ci.org/releases/</url>
    </repository>
    <snapshotRepository>
      <id>maven.jenkins-ci.org</id>
      <url>https://repo.jenkins-ci.org/snapshots/</url>
    </snapshotRepository>
  </distributionManagement>

  <profiles>
    <profile>
      <id>uninherited-java.level</id>
      <activation>
        <file>
          <exists>${basedir}/src/it/undefined-java-level/pom.xml</exists> <!-- just something that is only here -->
        </file>
      </activation>
      <properties>
        <java.level>8</java.level>
      </properties>
    </profile>
    <profile>
      <id>jenkins-release</id>
      <properties>
        <skipTests>${release.skipTests}</skipTests>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
              <execution>
                <id>attach-test-sources</id>
                <goals>
                  <goal>test-jar</goal>
                </goals>
                <configuration>
                  <skipSource>${no-test-jar}</skipSource>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
        <id>only-eclipse</id>
        <activation>
          <property>
            <name>m2e.version</name>
          </property>
        </activation>
        <build>
            <pluginManagement>
                <plugins>
                <!--
                    This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.
                    the plugins mention here are the ones we do not have direct control over, but are used for a jenkins plugin - all other
                    will be changed to in there source to support eclipse soon (hpi, license, localizer, access-modifier).
                    see also: http://wiki.eclipse.org/M2E_compatible_maven_plugins
                -->
                <plugin>
                  <groupId>org.eclipse.m2e</groupId>
                  <artifactId>lifecycle-mapping</artifactId>
                  <version>1.0.0</version>
                  <configuration>
                    <lifecycleMappingMetadata>
                      <pluginExecutions>
                        <pluginExecution>
                          <pluginExecutionFilter>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-enforcer-plugin</artifactId>
                            <versionRange>[1.0,)</versionRange>
                            <goals>
                              <goal>display-info</goal>
                            </goals>
                          </pluginExecutionFilter>
                          <action>
                            <ignore />
                          </action>
                        </pluginExecution>
                        <pluginExecution>
                          <pluginExecutionFilter>
                            <groupId>org.codehaus.gmaven</groupId>
                            <artifactId>gmaven-plugin</artifactId>
                            <versionRange>[1.0,)</versionRange>
                            <goals>
                              <goal>testCompile</goal>
                              <goal>generateTestStubs</goal>
                            </goals>
                          </pluginExecutionFilter>
                          <action>
                            <ignore />
                          </action>
                        </pluginExecution>
                      </pluginExecutions>
                    </lifecycleMappingMetadata>
                  </configuration>
                </plugin>
                </plugins>
            </pluginManagement>
        </build>
    </profile>
    <profile>
      <id>always-check-remote-repositories</id>
      <properties>
        <maven.repository.update.freqency>always</maven.repository.update.freqency>
      </properties>
    </profile>
    <profile>
      <id>rerunFailingTests</id>
      <activation>
        <property>
          <name>!test</name>
        </property>
      </activation>
      <properties>
        <surefire.rerunFailingTestsCount>4</surefire.rerunFailingTestsCount>
      </properties>
    </profile>
    <profile>
      <id>skip-findbugs-with-tests</id>
      <activation>
        <property>
          <name>skipTests</name>
          <value>true</value>
        </property>
      </activation>
      <properties>
        <findbugs.skip>true</findbugs.skip>
      </properties>
    </profile>
    <profile>
      <id>skip-node-tests</id>
      <activation>
        <property>
          <name>skipTests</name>
          <value>true</value>
        </property>
      </activation>
      <properties>
        <skip.node.tests>--skipTests --skipLint</skip.node.tests>
      </properties>
    </profile>
    <profile>
      <id>skip-node-lint</id>
      <activation>
        <property>
          <name>skipLint</name>
          <value>true</value>
        </property>
      </activation>
      <properties>
        <skip.node.lint>--skipLint</skip.node.lint>
      </properties>
    </profile>
    <profile>
      <id>findbugs-exclusion-file</id>
      <activation>
        <file>
          <exists>${basedir}/src/findbugs/excludesFilter.xml</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>findbugs</id>
                <configuration>
                  <excludeFilterFile>${project.basedir}/src/findbugs/excludesFilter.xml</excludeFilterFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>skip-javadoc-with-tests</id>
      <activation>
        <property>
          <name>skipTests</name>
          <value>true</value>
        </property>
      </activation>
      <properties>
        <maven.javadoc.skip>true</maven.javadoc.skip>
      </properties>
    </profile>
    <profile>
      <id>all-tests</id>
      <activation>
        <property>
          <name>!test</name>
        </property>
      </activation>
      <properties>
        <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
      </properties>
    </profile>
    <profile>
      <id>enable-jacoco</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>report</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <excludes>
                <exclude>**/Messages.class</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>node-execution</id>
      <activation>
        <file>
          <exists>.mvn_exec_node</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <version>${frontend-version}</version>

            <executions>

              <execution>
                <phase>initialize</phase>
                <id>install node and npm</id>
                <goals>
                  <goal>install-node-and-npm</goal>
                </goals>
                <configuration>
                  <nodeVersion>v${node.version}</nodeVersion>
                  <npmVersion>${npm.version}</npmVersion>
                  <nodeDownloadRoot>https://repo.jenkins-ci.org/nodejs-dist/</nodeDownloadRoot>
                  <npmDownloadRoot>https://repo.jenkins-ci.org/npm-dist/</npmDownloadRoot>
                </configuration>
              </execution>

              <execution>
                <phase>initialize</phase>
                <id>npm install</id>
                <goals>
                  <goal>npm</goal>
                </goals>
                <configuration>
                  <!-- Note that this may not be omitted lest maven-release-plugin be confused (frontend-maven-plugin #109): -->
                  <arguments>install ${npm.loglevel}</arguments>
                </configuration>
              </execution>

              <execution>
                <phase>generate-sources</phase>
                <id>npm mvnbuild</id>
                <goals>
                  <goal>npm</goal>
                </goals>
                <configuration>
                  <!-- The package.json must define an "mvnbuild" script -->
                  <arguments>run mvnbuild</arguments>
                </configuration>
              </execution>

              <execution>
                <phase>test</phase>
                <id>npm mvntest</id>
                <goals>
                  <goal>npm</goal>
                </goals>
                <configuration>
                  <!-- The package.json must define an "mvntest" script -->
                  <arguments>run mvntest</arguments>
                </configuration>
              </execution>

            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>yarn-execution</id>
      <activation>
        <file>
          <exists>.mvn_exec_yarn</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <version>${frontend-version}</version>

            <executions>

              <execution>
                <phase>initialize</phase>
                <id>install node and yarn</id>
                <goals>
                  <goal>install-node-and-yarn</goal>
                </goals>
                <configuration>
                  <nodeVersion>v${node.version}</nodeVersion>
                  <yarnVersion>v${yarn.version}</yarnVersion>
                  <nodeDownloadRoot>https://repo.jenkins-ci.org/nodejs-dist/</nodeDownloadRoot>
                  <!-- tried to create a mirror for yarnDownloadRoot but it did not work -->
                </configuration>
              </execution>

              <execution>
                <phase>initialize</phase>
                <id>yarn install</id>
                <goals>
                  <goal>yarn</goal>
                </goals>
                <configuration>
                  <!-- ensure only one concurrent 'yarn install' -->
                  <!-- when yarn cache is empty, multiple yarns performing network fetches frequently results in opaque errors -->
                  <arguments>--mutex network</arguments>
                </configuration>
              </execution>

              <execution>
                <phase>generate-sources</phase>
                <id>yarn mvnbuild</id>
                <goals>
                  <goal>yarn</goal>
                </goals>
                <configuration>
                  <!-- The package.json must define an "mvnbuild" script -->
                  <arguments>run mvnbuild</arguments>
                </configuration>
              </execution>

              <execution>
                <phase>test</phase>
                <id>yarn mvntest</id>
                <goals>
                  <goal>yarn</goal>
                </goals>
                <configuration>
                  <!-- The package.json must define an "mvntest" script -->
                  <arguments>run mvntest</arguments>
                </configuration>
              </execution>

            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>clean-node</id>
      <activation>
        <file>
          <exists>package.json</exists>
        </file>
        <property>
          <name>cleanNode</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <configuration>
              <filesets>
                <fileset>
                  <directory>node</directory>
                  <followSymlinks>false</followSymlinks>
                </fileset>
                <fileset>
                  <directory>node_modules</directory>
                  <followSymlinks>false</followSymlinks>
                </fileset>
              </filesets>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>jgit-scm-provider</id>
      <activation>
        <property>
          <name>git.provider</name>
          <value>jgit</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
              <providerImplementations>
                <git>${git.provider}</git>
              </providerImplementations>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>org.apache.maven.scm</groupId>
                <artifactId>maven-scm-provider-jgit</artifactId>
                <version>${maven-scm.version}</version>
              </dependency>
            </dependencies>
          </plugin>
          <plugin>
            <artifactId>maven-scm-plugin</artifactId>
            <version>${maven-scm.version}</version>
            <configuration>
              <providerImplementations>
                <git>${git.provider}</git>
              </providerImplementations>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>org.apache.maven.scm</groupId>
                <artifactId>maven-scm-provider-jgit</artifactId>
                <version>${maven-scm.version}</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>jitpack</id>
      <activation>
        <property>
          <name>env.JITPACK</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
              <execution>
                <id>attach-test-sources</id>
                <goals>
                  <goal>test-jar</goal>
                </goals>
                <configuration>
                  <skipSource>${no-test-jar}</skipSource>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>run-plugin-pom-its</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>mrm-maven-plugin</artifactId>
            <version>1.0.1</version>
            <executions>
              <execution>
                <goals>
                  <goal>start</goal>
                  <goal>stop</goal>
                </goals>
                <configuration>
                  <propertyName>repository.proxy.url</propertyName>
                  <repositories>
                    <proxyRepo />
                  </repositories>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>2.0.0</version>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>install</goal>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <streamLogs>false</streamLogs>
                  <showErrors>true</showErrors>
                  <cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo>
                  <localRepositoryPath>${basedir}/target/local-repo</localRepositoryPath>
                  <settingsFile>src/it/settings.xml</settingsFile>
                  <filterProperties>
                    <repository.proxy.url>${repository.proxy.url}</repository.proxy.url>
                  </filterProperties>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
