示例#1
0
  public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException {
    modules = Collections.emptyMap(); // needed during load
    super.onLoad(parent, name);

    modules =
        loadChildren(
            this,
            getModulesDir(),
            new Function1<ModuleName, MavenModule>() {
              public ModuleName call(MavenModule module) {
                return module.getModuleName();
              }
            });
    // update the transient nest level field.
    MavenModule root = getRootModule();
    if (root != null && root.getChildren() != null) {
      List<MavenModule> sortedList = new ArrayList<MavenModule>();
      Stack<MavenModule> q = new Stack<MavenModule>();
      root.nestLevel = 0;
      q.push(root);
      while (!q.isEmpty()) {
        MavenModule p = q.pop();
        sortedList.add(p);
        List<MavenModule> children = p.getChildren();
        if (children != null) {
          for (MavenModule m : children) m.nestLevel = p.nestLevel + 1;
          for (int i = children.size() - 1; i >= 0; i--) // add them in the reverse order
          q.push(children.get(i));
        }
      }
      this.sortedActiveModules = sortedList;
    } else {
      this.sortedActiveModules = getDisabledModules(false);
    }

    if (reporters == null)
      reporters = new DescribableList<MavenReporter, Descriptor<MavenReporter>>(this);
    reporters.setOwner(this);
    if (publishers == null)
      publishers = new DescribableList<Publisher, Descriptor<Publisher>>(this);
    publishers.setOwner(this);
    if (buildWrappers == null)
      buildWrappers = new DescribableList<BuildWrapper, Descriptor<BuildWrapper>>(this);
    buildWrappers.setOwner(this);

    updateTransientActions();
  }
示例#2
0
  protected void submit(StaplerRequest req, StaplerResponse rsp)
      throws IOException, ServletException, FormException {
    super.submit(req, rsp);
    JSONObject json = req.getSubmittedForm();

    rootPOM = Util.fixEmpty(req.getParameter("rootPOM").trim());
    if (rootPOM != null && rootPOM.equals("pom.xml")) rootPOM = null; // normalization

    goals = Util.fixEmpty(req.getParameter("goals").trim());
    alternateSettings = Util.fixEmpty(req.getParameter("alternateSettings").trim());
    mavenOpts = Util.fixEmpty(req.getParameter("mavenOpts").trim());
    mavenName = req.getParameter("maven_version");
    aggregatorStyleBuild = !req.hasParameter("maven.perModuleBuild");
    usePrivateRepository = req.hasParameter("maven.usePrivateRepository");
    ignoreUpstremChanges = !json.has("triggerByDependency");
    incrementalBuild = req.hasParameter("maven.incrementalBuild");
    archivingDisabled = req.hasParameter("maven.archivingDisabled");

    reporters.rebuild(req, json, MavenReporters.getConfigurableList());
    publishers.rebuild(req, json, BuildStepDescriptor.filter(Publisher.all(), this.getClass()));
    buildWrappers.rebuild(req, json, BuildWrappers.getFor(this));
  }
示例#3
0
 public void logRotate() throws IOException, InterruptedException {
   super.logRotate();
   // perform the log rotation of modules
   for (MavenModule m : modules.values()) m.logRotate();
 }