mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-18 17:48:14 +08:00
Avoid applying Kotlin JPA plugin
Applying plugins imperatively is discouraged, and since the plugin is added to the plugins block anyway, it is applied already. See gh-853
This commit is contained in:
@@ -45,7 +45,6 @@ public class KotlinJpaGradleBuildCustomizer implements BuildCustomizer<GradleBui
|
||||
if (this.buildMetadataResolver.hasFacet(build, "jpa")) {
|
||||
build.addPlugin("org.jetbrains.kotlin.plugin.jpa",
|
||||
this.settings.getVersion());
|
||||
build.applyPlugin("kotlin-jpa");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -39,7 +39,7 @@ class KotlinJpaGradleBuildCustomizerTests {
|
||||
Dependency dependency = Dependency.withId("foo");
|
||||
dependency.setFacets(Collections.singletonList("jpa"));
|
||||
GradleBuild build = getCustomizedBuild(dependency);
|
||||
assertThat(build.getAppliedPlugins()).contains("kotlin-jpa");
|
||||
assertThat(build.getAppliedPlugins()).isEmpty();
|
||||
assertThat(build.getPlugins()).hasSize(1);
|
||||
assertThat(build.getPlugins().get(0).getId())
|
||||
.isEqualTo("org.jetbrains.kotlin.plugin.jpa");
|
||||
@@ -50,7 +50,6 @@ class KotlinJpaGradleBuildCustomizerTests {
|
||||
void customizeWhenJpaFacetAbsentShouldNotAddKotlinJpaPlugin() {
|
||||
Dependency dependency = Dependency.withId("foo");
|
||||
GradleBuild build = getCustomizedBuild(dependency);
|
||||
assertThat(build.getAppliedPlugins()).hasSize(0);
|
||||
assertThat(build.getPlugins()).hasSize(0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user