mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Reuse optional configuration name constant
See gh-19620
This commit is contained in:
parent
77badf77f7
commit
8757f63360
@ -44,7 +44,7 @@ public class OptionalDependenciesPlugin implements Plugin<Project> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Project project) {
|
public void apply(Project project) {
|
||||||
Configuration optional = project.getConfigurations().create("optional");
|
Configuration optional = project.getConfigurations().create(OPTIONAL_CONFIGURATION_NAME);
|
||||||
optional.attributes((attributes) -> attributes.attribute(Usage.USAGE_ATTRIBUTE,
|
optional.attributes((attributes) -> attributes.attribute(Usage.USAGE_ATTRIBUTE,
|
||||||
project.getObjects().named(Usage.class, Usage.JAVA_RUNTIME)));
|
project.getObjects().named(Usage.class, Usage.JAVA_RUNTIME)));
|
||||||
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
|
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
|
||||||
|
@ -57,7 +57,7 @@ public class OptionalDependenciesPluginIntegrationTests {
|
|||||||
out.println("}");
|
out.println("}");
|
||||||
}
|
}
|
||||||
BuildResult buildResult = runGradle("printConfigurations");
|
BuildResult buildResult = runGradle("printConfigurations");
|
||||||
assertThat(buildResult.getOutput()).contains("optional");
|
assertThat(buildResult.getOutput()).contains(OptionalDependenciesPlugin.OPTIONAL_CONFIGURATION_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user