/**
   * Get the file with Jenkins to run.
   *
   * <p>The file will exist on machine where tests run.
   */
  @Provides
  @Named("jenkins.war")
  public File getJenkinsWar(
      RepositorySystem repositorySystem, RepositorySystemSession repositorySystemSession) {
    try {
      return IOUtil.firstExisting(
          false, System.getenv("JENKINS_WAR"), getWorkspace() + "/jenkins.war", "./jenkins.war");
    } catch (IOException ex) {
      // Fall-through
    }

    String version = System.getenv("JENKINS_VERSION");
    if (version != null && !version.isEmpty()) {
      ArtifactResolverUtil resolverUtil =
          new ArtifactResolverUtil(repositorySystem, repositorySystemSession);
      ArtifactResult resolvedArtifact =
          resolverUtil.resolve(
              new DefaultArtifact("org.jenkins-ci.main", "jenkins-war", "war", version));
      return resolvedArtifact.getArtifact().getFile();
    }

    // TODO add support for 'lts', 'lts-rc', 'latest' and 'latest-rc'

    throw new Error(
        "Could not find jenkins.war, use JENKINS_WAR or JENKINS_VERSION to specify it.");
  }
 /**
  * Provides the path to the form elements plug-in. Uses the Maven repository to obtain the plugin.
  *
  * @return the path to the form elements plug-in
  */
 @Named("form-element-path.hpi")
 @Provides
 public File getFormElementsPathFile(
     RepositorySystem repositorySystem, RepositorySystemSession repositorySystemSession) {
   ArtifactResolverUtil resolverUtil =
       new ArtifactResolverUtil(repositorySystem, repositorySystemSession);
   ArtifactResult resolvedArtifact =
       resolverUtil.resolve(
           new DefaultArtifact("org.jenkins-ci.plugins", "form-element-path", "hpi", "1.4"));
   return resolvedArtifact.getArtifact().getFile();
 }