提交 a06bcf8d 编写于 作者: K kohsuke

modified so as not to clobber the existing configuration of modules.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1969 71c3de6d-444a-0410-be80-ed276b4c234a
上级 1b9f71ce
......@@ -53,6 +53,16 @@ public final class MavenModule extends AbstractProject<MavenModule,MavenBuild> i
/*package*/ MavenModule(MavenModuleSet parent, PomInfo pom) {
super(parent, pom.name.toFileSystemName());
reconfigure(pom);
}
/**
* Called to update the module with the new POM.
* <p>
* This method is invoked on {@link MavenModule} that has the matching
* {@link ModuleName}.
*/
/*package*/ final void reconfigure(PomInfo pom) {
this.displayName = pom.displayName;
this.relativePath = pom.relativePath;
this.dependencies = pom.dependencies;
......@@ -142,4 +152,14 @@ public final class MavenModule extends AbstractProject<MavenModule,MavenBuild> i
// dependency setting might have been changed by the user, so rebuild.
Hudson.getInstance().rebuildDependencyGraph();
}
/**
* Marks this build as disabled.
*/
public void disable() throws IOException {
if(!disabled) {
disabled = true;
save();
}
}
}
......@@ -263,12 +263,26 @@ public class MavenModuleSet extends AbstractItem implements TopLevelItem, ItemGr
});
synchronized(modules) {
Map<ModuleName,MavenModule> old = new HashMap<ModuleName, MavenModule>(modules);
modules.clear();
for (PomInfo pom : poms) {
MavenModule mm = new MavenModule(this,pom);
MavenModule mm = old.get(pom.name);
if(mm!=null) {// found an existing matching module
mm.reconfigure(pom);
modules.put(pom.name,mm);
} else {// this looks like a new module
mm = new MavenModule(this,pom);
modules.put(mm.getModuleName(),mm);
}
mm.save();
modules.put(mm.getModuleName(),mm);
}
// remaining modules are no longer active.
old.keySet().removeAll(modules.keySet());
for (MavenModule om : old.values())
om.disable();
modules.putAll(old);
}
Hudson.getInstance().rebuildDependencyGraph();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册