Package hudson.maven

Examples of hudson.maven.MavenModuleSet$DescriptorImpl


    System.out.println(buildLogEnv);
    assertFalse(buildLogEnv.contains(DUMMY_LOCATION_VARNAME));
  }

    public void testNativeMavenOnSlave() throws Exception {
        MavenModuleSet project = createMavenProject();
        project.setJDK(hudson.getJDK("varJDK"));
        project.setScm(new ExtractResourceSCM(getClass().getResource(
                "/simple-projects.zip")));

        project.setMaven("varMaven");
        project.setGoals("clean${" + DUMMY_LOCATION_VARNAME + "}");

        // test the regular slave - variable not expanded
        project.setAssignedLabel(slaveRegular.getSelfLabel());
        MavenModuleSetBuild build = project.scheduleBuild2(0).get();
        System.out.println(build.getDisplayName() + " completed");

        assertBuildStatus(Result.FAILURE, build);

        String buildLogRegular = getBuildLog(build);
        System.out.println(buildLogRegular);

        // test the slave with prepared environment
        project.setAssignedLabel(slaveEnv.getSelfLabel());
        build = project.scheduleBuild2(0).get();
        System.out.println(build.getDisplayName() + " completed");

        assertBuildStatusSuccess(build);

        // Check variable was expanded
View Full Code Here


    return ((MavenModule) tr.owner.getProject()).getModuleName().toString();
  }

  @Override
  public MavenBuild resolveChild(Child child) {
    MavenModuleSet mms = (MavenModuleSet) owner.getProject();
    MavenModule m = mms.getModule(child.name);
    if (m != null) {
      return m.getBuildByNumber(child.build);
    }
    return null;
  }
View Full Code Here

      SonarPublisher sonarPublisher,
      JDK jdk,
      SettingsProvider settings,
      GlobalSettingsProvider globalSettings,
      boolean usesLocalRepository) throws IOException, InterruptedException {
    MavenModuleSet mavenModuleProject = sonarPublisher.getMavenProject(build);
    EnvVars envVars = build.getEnvironment(listener);
    /**
     * MAVEN_OPTS
     */
    String mvnOptions = sonarPublisher.getMavenOpts();
    if (StringUtils.isEmpty(mvnOptions)
      && mavenModuleProject != null
      && StringUtils.isNotEmpty(mavenModuleProject.getMavenOpts())) {
      mvnOptions = mavenModuleProject.getMavenOpts();
    }
    // Private Repository and Alternate Settings
    LocalRepositoryLocator locaRepositoryToUse = usesLocalRepository ? new PerJobLocalRepositoryLocator() : new DefaultLocalRepositoryLocator();
    SettingsProvider settingsToUse = settings;
    GlobalSettingsProvider globalSettingsToUse = globalSettings;
    if (mavenModuleProject != null) {
      // If we are on a Maven job then take values from the job itself
      locaRepositoryToUse = mavenModuleProject.getLocalRepository();
      settingsToUse = mavenModuleProject.getSettings();
      globalSettingsToUse = mavenModuleProject.getGlobalSettings();
    }
    // Other properties
    String installationProperties = sonarInstallation.getAdditionalProperties();
    String jobProperties = envVars.expand(sonarPublisher.getJobAdditionalProperties());
    String aditionalProperties = ""
View Full Code Here

    return (build.getProject() instanceof MavenModuleSet) ? (MavenModuleSet) build.getProject() : null;
  }

  private String getPomName(AbstractBuild<?, ?> build, BuildListener listener) throws IOException, InterruptedException {
    String pomName;
    MavenModuleSet mavenModuleProject = getMavenProject(build);
    if (mavenModuleProject != null) {
      EnvVars envVars = build.getEnvironment(listener);
      pomName = mavenModuleProject.getRootPOM(envVars);
    } else {
      pomName = getRootPom();
    }
    if (StringUtils.isEmpty(pomName)) {
      pomName = "pom.xml";
View Full Code Here

  private boolean executeSonar(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener, SonarInstallation sonarInstallation) {
    try {
      String pomName = getPomName(build, listener);
      String mavenInstallName = getMavenInstallationName();
      if (isMavenBuilder(build.getProject())) {
        MavenModuleSet mavenModuleSet = getMavenProject(build);
        if (null != mavenModuleSet.getMaven().getName()) {
          mavenInstallName = mavenModuleSet.getMaven().getName();
        }
      }

      // Execute maven
      return SonarMaven.executeMaven(build, launcher, listener, mavenInstallName, pomName, sonarInstallation, this, getJDK(),
View Full Code Here

    mailer.recipients = "me@example.org";
  }

  @Ignore("Ingored due to changes in triggers")
  public void ignore_testMavenProject() throws Exception {
    MavenModuleSet project = setupMavenProject();
    project.getPublishersList().add(mailer);
    inbox.clear();
    AbstractBuild<?, ?> build = build(project, Result.FAILURE);

    assertSonarExecution(build, "-f " + getPom(build, "pom.xml"));
    assertThat(inbox.size()).isEqualTo(1);
View Full Code Here

  protected String getPom(AbstractBuild<?, ?> build, String pomName) {
    return build.getWorkspace().child(pomName).getRemote();
  }

  protected MavenModuleSet setupMavenProject(String pomName) throws Exception {
    MavenModuleSet project = j.createMavenProject("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;
  }
View Full Code Here

  @Ignore("Ingored due to changes in triggers")
  public void ignore_testMavenProject() throws Exception {
    configureDefaultMaven();
    configureDefaultSonar();
    String pomName = "space test/root-pom.xml";
    MavenModuleSet project = setupMavenProject(pomName);
    project.setAlternateSettings("/settings.xml");
    project.setLocalRepository(new PerJobLocalRepositoryLocator());
    AbstractBuild<?, ?> build = build(project);

    String repo = build.getWorkspace().child(".repository").getRemote();
    // TODO Check that there is no POM-generation for Maven project
    assertSonarExecution(build, "-f \"" + getPom(build, pomName) + "\" -Dmaven.repo.local=" + repo + " -s /settings.xml");
View Full Code Here

   */
  @Ignore("Ingored due to changes in triggers")
  public void ignore_testPassword() throws Exception {
    configureDefaultMaven();
    configureSecuredSonar();
    MavenModuleSet project = setupMavenProject();
    AbstractBuild<?, ?> build = build(project);

    assertLogContains("sonar:sonar", build);
    assertLogDoesntContains("-Dsonar.jdbc.username=dbuser", build);
    assertLogDoesntContains("-Dsonar.jdbc.password=dbpassword", build);
View Full Code Here

    public List<MetadataValue> getMetaDataFor(AbstractProject job) {
        if (job instanceof MavenModule) {
            MavenModule module = (MavenModule)job;
            return getModuleData(module);
        } else if (job instanceof MavenModuleSet) {
            MavenModuleSet p = (MavenModuleSet)job;
            MavenModule module = p.getRootModule();
            return getModuleData(module);
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of hudson.maven.MavenModuleSet$DescriptorImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.