use of jenkins.mvn.GlobalMavenConfig in project configuration-as-code-plugin by jenkinsci.
the class MavenConfiguratorTest method configure_maven_global_config_specific_files.
@Test
@ConfiguredWithReadme("maven/README.md#2")
public void configure_maven_global_config_specific_files() {
final GlobalMavenConfig descriptor = ExtensionList.lookupSingleton(GlobalMavenConfig.class);
assertThat(descriptor.getGlobalSettingsProvider(), instanceOf(FilePathGlobalSettingsProvider.class));
FilePathGlobalSettingsProvider globalProvider = (FilePathGlobalSettingsProvider) descriptor.getGlobalSettingsProvider();
assertThat(globalProvider.getPath(), is("/conf/maven/global-settings.xml"));
assertThat(descriptor.getSettingsProvider(), instanceOf(FilePathSettingsProvider.class));
FilePathSettingsProvider provider = (FilePathSettingsProvider) descriptor.getSettingsProvider();
assertThat(provider.getPath(), is("/conf/maven/settings.xml"));
}
use of jenkins.mvn.GlobalMavenConfig in project configuration-as-code-plugin by jenkinsci.
the class MavenConfiguratorTest method configure_maven_global_config.
@Test
@ConfiguredWithReadme("maven/README.md#1")
public void configure_maven_global_config() {
final GlobalMavenConfig descriptor = ExtensionList.lookupSingleton(GlobalMavenConfig.class);
assertThat(descriptor.getGlobalSettingsProvider(), instanceOf(DefaultGlobalSettingsProvider.class));
assertThat(descriptor.getSettingsProvider(), instanceOf(DefaultSettingsProvider.class));
}
use of jenkins.mvn.GlobalMavenConfig in project configuration-as-code-plugin by jenkinsci.
the class MavenConfigurator method describe.
@NonNull
@Override
public Set<Attribute<GlobalMavenConfig, ?>> describe() {
final Set<Attribute<GlobalMavenConfig, ?>> attributes = super.describe();
final Descriptor descriptor = Jenkins.get().getDescriptorOrDie(Maven.class);
final Configurator<Descriptor> task = new DescriptorConfigurator(descriptor);
for (Attribute attribute : task.describe()) {
attributes.add(new Attribute<GlobalMavenConfig, Object>(attribute.getName(), attribute.getType()).multiple(attribute.isMultiple()).getter(g -> attribute.getValue(descriptor)).setter((g, v) -> attribute.setValue(descriptor, v)));
}
return attributes;
}
Aggregations