Describe the problem
I'm using gradle to build my project, I've defined a plugin 'spring-boot-native-dubbo-application', I want to configure some native public configuration in it, But I found it impossible to type safely use 'tasks.processAot' in the plugin 'spring-boot-native-dubbo-application' :
But in a project that uses the 'spring-boot-native-dubbo-application' plugin, it is possible to type safely configure 'tasks.processAot'
But that would be tedious, because it would have to be configured for every project that uses native. Is there any way to configure 'tasks.processAot' in a common way?
System Info (please complete the following information): - OS: window10 - GraalVM Version 8.4 - Java Version graalvm 21 - native-build-tools Plugin version 0.9.28 - spring boot version: 3.1.5
Comment From: wilkinsona
Sorry, I don't understand the problem. It appears to be an issue with Gradle Kotlin scripts but I'm not sure how Spring Boot's Gradle plugin can have caused that. Perhaps you can provide a minimal sample that reproduces the problem? The screenshots aren't very informative I'm afraid.
Comment From: ShipinZ
Sorry, I don't understand the problem. It appears to be an issue with Gradle Kotlin scripts but I'm not sure how Spring Boot's Gradle plugin can have caused that. Perhaps you can provide a minimal sample that reproduces the problem? The screenshots aren't very informative I'm afraid.
Sorry, I may not have described it clearly. I created a new demo repository, which should describe my question https://github.com/JoyfulAndSpeedyMan/spring-native-gradle-demo.git
Comment From: wilkinsona
It looks like a bug in your IDE to me. Everything works on the command line.
Comment From: ShipinZ
It looks like a bug in your IDE to me. Everything works on the command line.
Yes, the configuration does work from the command line. This is because the args("--spring.profiles.active=$profiles") is commented out of the build-logic/spring-boot-native-application/src/main/kotlin/com.example.spring-boot-native-application.gradle. kts file. If you do that, you get an error
Comment From: wilkinsona
Thanks. I see the error now. It still doesn't look like a Spring Boot problem though. It appears to be a problem with type interference at compile time and Spring Boot has no influence over that. I suspect it's because your com.example.spring-boot-application has declared org.springframework.boot:org.springframework.boot.gradle.plugin as an implementation dependency so it's only visible to consumers at runtime and not at compile time.
Comment From: ShipinZ
Yes, if the declaration org.springframework.boot:org.springframework.boot.gradle.plugin is displayed, this problem will not occur, should this question be asked to the gradle repository?
Comment From: wilkinsona
No, I don't think so. I think you need to correct your com.example.spring-boot-application plugin so that it declares org.springframework.boot:org.springframework.boot.gradle.plugin as an api dependency. This will make it visible to consumers at compile time and fix the compilation problem in your com.example.spring-boot-native-application plugin.
Comment From: ShipinZ
Thank you very much, using api() way can normally pass org.springframework.boot:org.springframework.boot.gradle.plugin plugin dependencies, the problem can be solved perfectly.