use of hudson.tasks.Maven in project sonar-scanner-jenkins by SonarSource.
the class SonarTestCase method configureDefaultMaven.
/**
* Returns Fake Maven Installation.
*
* @return Fake Maven Installation
* @throws Exception if something is wrong
*/
protected Maven.MavenInstallation configureDefaultMaven() throws Exception {
File mvn = new File(getClass().getResource("SonarTestCase/maven/bin/mvn").toURI().getPath());
if (!Functions.isWindows()) {
// noinspection OctalInteger
GNUCLibrary.LIBC.chmod(mvn.getPath(), 0755);
}
String home = mvn.getParentFile().getParentFile().getAbsolutePath();
Maven.MavenInstallation mavenInstallation = new Maven.MavenInstallation("default", home, JenkinsRule.NO_PROPERTIES);
j.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
return mavenInstallation;
}
use of hudson.tasks.Maven in project configuration-as-code-plugin by jenkinsci.
the class MavenConfiguratorTest method configure_maven_tool.
@Test
@ConfiguredWithReadme("maven/README.md#0")
public void configure_maven_tool() {
final Maven.DescriptorImpl descriptor = ExtensionList.lookupSingleton(Maven.DescriptorImpl.class);
assertEquals(1, descriptor.getInstallations().length);
Maven.MavenInstallation maven = descriptor.getInstallations()[0];
assertEquals("maven3", maven.getName());
assertEquals("/maven3", maven.getHome());
InstallSourceProperty installSourceProperty = maven.getProperties().get(InstallSourceProperty.class);
assertEquals(1, installSourceProperty.installers.size());
MavenInstaller installer = installSourceProperty.installers.get(MavenInstaller.class);
assertEquals("3.8.4", installer.id);
}
use of hudson.tasks.Maven in project configuration-as-code-plugin by jenkinsci.
the class MavenConfiguratorTest method should_configure_maven_tools_and_global_config.
@Test
@ConfiguredWithCode("MavenConfiguratorTest.yml")
public void should_configure_maven_tools_and_global_config() {
final Maven.DescriptorImpl descriptor = (Maven.DescriptorImpl) j.jenkins.getDescriptorOrDie(Maven.class);
Assert.assertEquals(1, descriptor.getInstallations().length);
Assert.assertEquals("/usr/share/maven", descriptor.getInstallations()[0].getHome());
InstallSourceProperty installSourceProperty = descriptor.getInstallations()[0].getProperties().get(InstallSourceProperty.class);
Assert.assertEquals("3.5.0", installSourceProperty.installers.get(Maven.MavenInstaller.class).id);
final SettingsProvider provider = GlobalMavenConfig.get().getSettingsProvider();
Assert.assertTrue(provider instanceof FilePathSettingsProvider);
Assert.assertEquals("/usr/share/maven-settings.xml", ((FilePathSettingsProvider) provider).getPath());
}
Aggregations