diff --git a/sofa-boot-project/sofa-boot-tools/sofa-boot-gradle-plugin/build.gradle b/sofa-boot-project/sofa-boot-tools/sofa-boot-gradle-plugin/build.gradle
index ac82ff882..39b8404c3 100644
--- a/sofa-boot-project/sofa-boot-tools/sofa-boot-gradle-plugin/build.gradle
+++ b/sofa-boot-project/sofa-boot-tools/sofa-boot-gradle-plugin/build.gradle
@@ -17,11 +17,11 @@ repositories {
dependencies {
implementation localGroovy()
implementation gradleApi()
- implementation 'org.springframework.boot:spring-boot-gradle-plugin:2.3.9.RELEASE'
- implementation 'org.springframework.boot:spring-boot-loader-tools:2.3.9.RELEASE'
+ implementation 'org.springframework.boot:spring-boot-gradle-plugin:2.4.13'
+ implementation 'org.springframework.boot:spring-boot-loader-tools:2.4.13'
implementation 'io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE'
implementation "org.apache.commons:commons-compress:1.19"
- implementation "org.springframework:spring-core:5.2.13.RELEASE"
+ implementation "org.springframework:spring-core:5.3.18"
testImplementation 'junit:junit:4.13.1'
testImplementation gradleTestKit()
}
diff --git a/sofa-boot-project/sofa-boot-tools/sofa-boot-gradle-plugin/pom.xml b/sofa-boot-project/sofa-boot-tools/sofa-boot-gradle-plugin/pom.xml
index 5516feda6..c9243b745 100644
--- a/sofa-boot-project/sofa-boot-tools/sofa-boot-gradle-plugin/pom.xml
+++ b/sofa-boot-project/sofa-boot-tools/sofa-boot-gradle-plugin/pom.xml
@@ -22,7 +22,7 @@
org.springframework.boot
spring-boot-gradle-plugin
- 2.3.9.RELEASE
+ 2.4.13
io.spring.gradle
diff --git a/sofa-boot-project/sofa-boot-tools/sofa-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SofaBootPlugin.java b/sofa-boot-project/sofa-boot-tools/sofa-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SofaBootPlugin.java
index f6eb309f1..5ca427c2c 100644
--- a/sofa-boot-project/sofa-boot-tools/sofa-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SofaBootPlugin.java
+++ b/sofa-boot-project/sofa-boot-tools/sofa-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SofaBootPlugin.java
@@ -16,6 +16,14 @@
*/
package org.springframework.boot.gradle.plugin;
+import com.alipay.sofa.boot.gradle.plugin.Marker;
+import org.gradle.api.GradleException;
+import org.gradle.api.Plugin;
+import org.gradle.api.Project;
+import org.gradle.api.artifacts.Configuration;
+import org.gradle.util.GradleVersion;
+import org.springframework.boot.gradle.dsl.SpringBootExtension;
+
import java.io.File;
import java.io.IOException;
import java.net.JarURLConnection;
@@ -23,19 +31,10 @@
import java.net.URLConnection;
import java.util.Arrays;
import java.util.List;
+import java.util.function.Consumer;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
-import org.gradle.api.GradleException;
-import org.gradle.api.Plugin;
-import org.gradle.api.Project;
-import org.gradle.api.artifacts.Configuration;
-import org.gradle.api.artifacts.ResolvableDependencies;
-import org.gradle.util.GradleVersion;
-import org.springframework.boot.gradle.dsl.SpringBootExtension;
-
-import com.alipay.sofa.boot.gradle.plugin.Marker;
-
/**
* Gradle plugin for SOFA Boot. (Origin from {@link SpringBootPlugin})
*
@@ -70,7 +69,6 @@ public void apply(Project project) {
createExtension(project);
Configuration bootArchives = createBootArchivesConfiguration(project);
registerPluginActions(project, bootArchives);
- unregisterUnresolvedDependenciesAnalyzer(project);
}
private void verifyGradleVersion() {
@@ -92,6 +90,7 @@ private Configuration createBootArchivesConfiguration(Project project) {
Configuration bootArchives = project.getConfigurations().create(
BOOT_ARCHIVES_CONFIGURATION_NAME);
bootArchives.setDescription("Configuration for Spring Boot archive artifacts.");
+ bootArchives.setCanBeResolved(false);
return bootArchives;
}
@@ -105,29 +104,18 @@ private void registerPluginActions(Project project, Configuration bootArchives)
new SofaDependencyManagementPluginAction(), new ApplicationPluginAction(),
new KotlinPluginAction());
for (PluginApplicationAction action : actions) {
- Class extends Plugin extends Project>> pluginClass = action
- .getPluginClass();
- if (pluginClass != null) {
- project.getPlugins().withType(pluginClass,
- (plugin) -> action.execute(project));
- }
+ withPluginClassOfAction(action,
+ (pluginClass) -> project.getPlugins().withType(pluginClass, (plugin) -> action.execute(project)));
}
}
- private void unregisterUnresolvedDependenciesAnalyzer(Project project) {
- UnresolvedDependenciesAnalyzer unresolvedDependenciesAnalyzer = new UnresolvedDependenciesAnalyzer();
- project.getConfigurations().all((configuration) -> {
- ResolvableDependencies incoming = configuration.getIncoming();
- incoming.afterResolve((resolvableDependencies) -> {
- if (incoming.equals(resolvableDependencies)) {
- unresolvedDependenciesAnalyzer.analyze(configuration
- .getResolvedConfiguration().getLenientConfiguration()
- .getUnresolvedModuleDependencies());
- }
- });
- });
- project.getGradle().buildFinished(
- (buildResult) -> unresolvedDependenciesAnalyzer.buildFinished(project));
+ private void withPluginClassOfAction(PluginApplicationAction action,
+ Consumer>> consumer) {
+ try {
+ consumer.accept(action.getPluginClass());
+ } catch (Throwable ex) {
+ // Plugin class unavailable. Continue.
+ }
}
// This method always returns null when executing gradle test