use of hudson.plugins.sonar.SonarPublisher.DescriptorImpl in project sonar-scanner-jenkins by SonarSource.
the class SonarGlobalConfiguration method migrate.
/**
* Attempts to migrated data from SonarPublished, which was previously holding the global configuration.
* It is thread safe and will refuse to migrate if a SonarQube installation already exists in this class.
* Migration will only be attempted once.
*/
@Initializer(after = InitMilestone.PLUGINS_PREPARED)
public void migrate() {
if (migrated) {
return;
}
synchronized (this) {
if (migrated) {
return;
}
// SonarPublisher might be null if Maven plugin is disabled or not installed
Jenkins j = Jenkins.getInstance();
DescriptorImpl publisher = j.getDescriptorByType(SonarPublisher.DescriptorImpl.class);
if (publisher != null && publisher.getDeprecatedInstallations() != null && publisher.getDeprecatedInstallations().length > 0) {
if (ArrayUtils.isEmpty(this.installations)) {
this.installations = publisher.getDeprecatedInstallations();
this.buildWrapperEnabled = publisher.isDeprecatedBuildWrapperEnabled();
save();
} else {
Logger.LOG.warning("SonarQube server configurations exist in both deprecated SonarPublisher and SonarGlobalConfiguration. Deleting deprecated configuration..");
}
publisher.deleteGlobalConfiguration();
}
migrated = true;
}
}
Aggregations