Hudson CI - Add recipient to all jobs
Case: A recipient doesn't exist for all of your hudson jobs (projects). You have to select all projets and add the missing recipient. Not nice. The following script can do this for you.
import hudson.plugins.emailext.*
import hudson.model.*
import hudson.maven.*
import hudson.maven.reporters.*
import hudson.tasks.*
for(item in Hudson.instance.items) {
if(item instanceof MavenModuleSet) {
println("Apply maven project: $item.name");
if (item.reporters.empty) {
def reporter = new MavenMailer();
reporter.recipients = !!!your email address!!!
item.reporters.add(reporter)
println("+ Add new reporter $reporter.recipients");
} else {
for(reporter in item.reporters) {
if(reporter instanceof MavenMailer) {
println("| Found reporter $reporter.recipients");
}
}
}
}
}
Open the hudson configutation page: "Manage Hudson > Script console" and run run this script. Thats it.
Hudson CI Javadoc/API: http://hudson-ci.org/javadoc/


