mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-20 02:29:44 +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")) {
|
if (this.buildMetadataResolver.hasFacet(build, "jpa")) {
|
||||||
build.addPlugin("org.jetbrains.kotlin.plugin.jpa",
|
build.addPlugin("org.jetbrains.kotlin.plugin.jpa",
|
||||||
this.settings.getVersion());
|
this.settings.getVersion());
|
||||||
build.applyPlugin("kotlin-jpa");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ class KotlinJpaGradleBuildCustomizerTests {
|
|||||||
Dependency dependency = Dependency.withId("foo");
|
Dependency dependency = Dependency.withId("foo");
|
||||||
dependency.setFacets(Collections.singletonList("jpa"));
|
dependency.setFacets(Collections.singletonList("jpa"));
|
||||||
GradleBuild build = getCustomizedBuild(dependency);
|
GradleBuild build = getCustomizedBuild(dependency);
|
||||||
assertThat(build.getAppliedPlugins()).contains("kotlin-jpa");
|
assertThat(build.getAppliedPlugins()).isEmpty();
|
||||||
assertThat(build.getPlugins()).hasSize(1);
|
assertThat(build.getPlugins()).hasSize(1);
|
||||||
assertThat(build.getPlugins().get(0).getId())
|
assertThat(build.getPlugins().get(0).getId())
|
||||||
.isEqualTo("org.jetbrains.kotlin.plugin.jpa");
|
.isEqualTo("org.jetbrains.kotlin.plugin.jpa");
|
||||||
@@ -50,7 +50,6 @@ class KotlinJpaGradleBuildCustomizerTests {
|
|||||||
void customizeWhenJpaFacetAbsentShouldNotAddKotlinJpaPlugin() {
|
void customizeWhenJpaFacetAbsentShouldNotAddKotlinJpaPlugin() {
|
||||||
Dependency dependency = Dependency.withId("foo");
|
Dependency dependency = Dependency.withId("foo");
|
||||||
GradleBuild build = getCustomizedBuild(dependency);
|
GradleBuild build = getCustomizedBuild(dependency);
|
||||||
assertThat(build.getAppliedPlugins()).hasSize(0);
|
|
||||||
assertThat(build.getPlugins()).hasSize(0);
|
assertThat(build.getPlugins()).hasSize(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user