use of org.jenkinsci.test.acceptance.utils.aether.ArtifactResolverUtil in project acceptance-test-harness by jenkinsci.
the class FallbackConfig method getJenkinsWar.
/**
* Get the file with Jenkins to run.
*
* 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"));
} catch (IOException ex) {
}
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();
}
try {
// Lowest priority of all
return IOUtil.firstExisting(false, System.getenv("JENKINS_WAR"), getWorkspace() + "/jenkins.war", "./jenkins.war");
} catch (IOException ex) {
throw new Error("Could not find jenkins.war, use JENKINS_WAR or JENKINS_VERSION to specify it.", ex);
}
}
use of org.jenkinsci.test.acceptance.utils.aether.ArtifactResolverUtil in project acceptance-test-harness by jenkinsci.
the class FallbackConfig method getFormElementsPathFile.
/**
* 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);
String version = System.getenv("FORM_ELEMENT_PATH_VERSION");
version = version == null ? "1.12" : version;
ArtifactResult resolvedArtifact = resolverUtil.resolve(new DefaultArtifact("org.jenkins-ci.plugins", "form-element-path", "hpi", version));
return resolvedArtifact.getArtifact().getFile();
}
use of org.jenkinsci.test.acceptance.utils.aether.ArtifactResolverUtil in project acceptance-test-harness by jenkinsci.
the class PluginMetadata method resolve.
public File resolve(Injector i, String version) {
DefaultArtifact artifact = getDefaultArtifact();
if (version != null) {
artifact.setVersion(version);
}
ArtifactResolverUtil resolverUtil = i.getInstance(ArtifactResolverUtil.class);
ArtifactResult r = resolverUtil.resolve(artifact);
return r.getArtifact().getFile();
}
Aggregations