Search in sources :

Example 16 with MavenModuleSet

use of hudson.maven.MavenModuleSet in project sonar-scanner-jenkins by SonarSource.

the class SonarTestCase method setupSonarMavenProject.

protected MavenModuleSet setupSonarMavenProject(String pomName) throws Exception {
    final MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "MavenProject");
    // Setup SCM
    project.setScm(new SingleFileSCM(pomName, getClass().getResource("/hudson/plugins/sonar/SonarTestCase/pom.xml")));
    // Setup Maven
    project.setRootPOM(pomName);
    project.setGoals("clean install");
    project.setIsArchivingDisabled(true);
    // Setup Sonar
    project.getPublishersList().add(newSonarPublisherForMavenProject());
    return project;
}
Also used : SingleFileSCM(org.jvnet.hudson.test.SingleFileSCM) MavenModuleSet(hudson.maven.MavenModuleSet)

Example 17 with MavenModuleSet

use of hudson.maven.MavenModuleSet in project sonar-scanner-jenkins by SonarSource.

the class BaseTest method testMavenProject.

/**
 * Maven Project.
 * <ul>
 * <li>SONARPLUGINS-19: Maven "-B" option (batch mode)</li>
 * <li>SONARPLUGINS-73: Root POM</li>
 * <li>SONARPLUGINS-101: Private Repository</li>
 * <li>SONARPLUGINS-253: Maven "-e" option</li>
 * <li>SONARPLUGINS-263: Path to POM with spaces</li>
 * <li>SONARPLUGINS-326: Use alternate settings file</li>
 * </ul>
 *
 * @throws Exception if something is wrong
 */
@Test
public void testMavenProject() throws Exception {
    configureDefaultMaven();
    configureDefaultSonar();
    String pomName = "space test/root-pom.xml";
    MavenModuleSet project = setupSonarMavenProject(pomName);
    project.setAlternateSettings("/settings.xml");
    project.setLocalRepository(new PerJobLocalRepositoryLocator());
    Run<?, ?> build = build(project);
}
Also used : PerJobLocalRepositoryLocator(hudson.maven.local_repo.PerJobLocalRepositoryLocator) MavenModuleSet(hudson.maven.MavenModuleSet) Test(org.junit.Test)

Aggregations

MavenModuleSet (hudson.maven.MavenModuleSet)17 Test (org.junit.Test)10 SonarPublisher (hudson.plugins.sonar.SonarPublisher)8 EnvVars (hudson.EnvVars)4 ArrayList (java.util.ArrayList)4 MavenModule (hudson.maven.MavenModule)3 IOException (java.io.IOException)3 FilePath (hudson.FilePath)2 PerJobLocalRepositoryLocator (hudson.maven.local_repo.PerJobLocalRepositoryLocator)2 ImmutableList (com.google.common.collect.ImmutableList)1 DefaultLocalRepositoryLocator (hudson.maven.local_repo.DefaultLocalRepositoryLocator)1 LocalRepositoryLocator (hudson.maven.local_repo.LocalRepositoryLocator)1 VirtualChannel (hudson.remoting.VirtualChannel)1 ArgumentListBuilder (hudson.util.ArgumentListBuilder)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 List (java.util.List)1 GlobalSettingsProvider (jenkins.mvn.GlobalSettingsProvider)1 SettingsProvider (jenkins.mvn.SettingsProvider)1