diff --git a/ihub-spring/src/main/groovy/pub/ihub/plugin/spring/IHubBootPlugin.groovy b/ihub-spring/src/main/groovy/pub/ihub/plugin/spring/IHubBootPlugin.groovy index c872bf41..47c7af7b 100644 --- a/ihub-spring/src/main/groovy/pub/ihub/plugin/spring/IHubBootPlugin.groovy +++ b/ihub-spring/src/main/groovy/pub/ihub/plugin/spring/IHubBootPlugin.groovy @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 the original author or authors. + * Copyright (c) 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import org.springframework.boot.gradle.tasks.run.BootRun import pub.ihub.plugin.IHubPlugin import pub.ihub.plugin.IHubPluginsExtension import pub.ihub.plugin.IHubProjectPluginAware +import pub.ihub.plugin.bom.IHubBomExtension import pub.ihub.plugin.java.IHubJavaPlugin import static org.springframework.boot.buildpack.platform.build.PullPolicy.IF_NOT_PRESENT @@ -40,6 +41,10 @@ class IHubBootPlugin extends IHubProjectPluginAware { @Override void apply() { + withExtension(IHubBomExtension).dependencies { + testImplementation 'org.spockframework:spock-spring' + testRuntimeOnly 'org.springframework.boot:spring-boot-starter-test' + } withExtension(AFTER) { ext -> withTask(BootRun) { ext.systemProperties it, '.boot-java-local.properties' diff --git a/ihub-spring/src/test/groovy/pub/ihub/plugin/spring/IHubBootPluginTest.groovy b/ihub-spring/src/test/groovy/pub/ihub/plugin/spring/IHubBootPluginTest.groovy index ef30feb6..a602c738 100644 --- a/ihub-spring/src/test/groovy/pub/ihub/plugin/spring/IHubBootPluginTest.groovy +++ b/ihub-spring/src/test/groovy/pub/ihub/plugin/spring/IHubBootPluginTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 the original author or authors. + * Copyright (c) 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,8 @@ class IHubBootPluginTest extends IHubSpecification { def result = gradleBuilder.build() then: '检查结果' + result.output.contains '│ testImplementation │ org.spockframework:spock-spring │' + result.output.contains '│ testRuntimeOnly │ org.springframework.boot:spring-boot-starter-test │' result.output.contains 'BUILD SUCCESSFUL' when: '构建项目' diff --git a/ihub-verification/src/main/groovy/pub/ihub/plugin/verification/IHubTestPlugin.groovy b/ihub-verification/src/main/groovy/pub/ihub/plugin/verification/IHubTestPlugin.groovy index 996b3a6c..1be09e40 100644 --- a/ihub-verification/src/main/groovy/pub/ihub/plugin/verification/IHubTestPlugin.groovy +++ b/ihub-verification/src/main/groovy/pub/ihub/plugin/verification/IHubTestPlugin.groovy @@ -48,8 +48,8 @@ class IHubTestPlugin extends IHubProjectPluginAware { (SPOCK) : { IHubBomExtension iHubBom -> applyPlugin GroovyPlugin iHubBom.dependencies { - testImplementation 'org.spockframework:spock-spring' - testRuntimeOnly 'com.athaydes:spock-reports', 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.spockframework:spock-core' + testRuntimeOnly 'com.athaydes:spock-reports' } }, (JUNIT_JUPITER): { IHubBomExtension iHubBom -> diff --git a/ihub-verification/src/test/groovy/pub/ihub/plugin/verification/IHubVerificationPluginTest.groovy b/ihub-verification/src/test/groovy/pub/ihub/plugin/verification/IHubVerificationPluginTest.groovy index 0fc5bb05..f49789cf 100644 --- a/ihub-verification/src/test/groovy/pub/ihub/plugin/verification/IHubVerificationPluginTest.groovy +++ b/ihub-verification/src/test/groovy/pub/ihub/plugin/verification/IHubVerificationPluginTest.groovy @@ -103,8 +103,8 @@ class IHubVerificationPluginTest extends IHubSpecification { result = gradleBuilder.withArguments('-DiHubTest.runSkippedPropNames=java.endorsed.dirs').build() then: '检查结果' - !result.output.contains('│ testImplementation │ org.spockframework:spock-spring │') - !result.output.contains('│ testRuntimeOnly │ com.athaydes:spock-reports │') + !result.output.contains('org.spockframework:spock-core') + !result.output.contains('com.athaydes:spock-reports') result.output.contains '│ pmd │ com.alibaba.p3c:p3c-pmd │' result.output.contains 'BUILD SUCCESSFUL' @@ -113,10 +113,9 @@ class IHubVerificationPluginTest extends IHubSpecification { result = gradleBuilder.withArguments('-DiHubTest.runIncludePropNames=java.endorsed.dirs').build() then: '检查结果' - result.output.contains '│ testImplementation │ org.spockframework:spock-spring │' - result.output.contains '│ testRuntimeOnly │ com.athaydes:spock-reports │' - result.output.contains '│ testRuntimeOnly │ org.springframework.boot:spring-boot-starter-test │' - result.output.contains '│ pmd │ com.alibaba.p3c:p3c-pmd │' + result.output.contains '│ testImplementation │ org.spockframework:spock-core │' + result.output.contains '│ testRuntimeOnly │ com.athaydes:spock-reports │' + result.output.contains '│ pmd │ com.alibaba.p3c:p3c-pmd │' result.output.contains 'BUILD SUCCESSFUL' } @@ -137,10 +136,9 @@ class IHubVerificationPluginTest extends IHubSpecification { def result = gradleBuilder.build() then: '检查结果' - result.output.contains '│ testImplementation │ org.spockframework:spock-spring │' - result.output.contains '│ testRuntimeOnly │ com.athaydes:spock-reports │' - result.output.contains '│ testRuntimeOnly │ org.springframework.boot:spring-boot-starter-test │' - result.output.contains '│ pmd │ com.alibaba.p3c:p3c-pmd │' + result.output.contains '│ testImplementation │ org.spockframework:spock-core │' + result.output.contains '│ testRuntimeOnly │ com.athaydes:spock-reports │' + result.output.contains '│ pmd │ com.alibaba.p3c:p3c-pmd │' result.output.contains 'BUILD SUCCESSFUL' }