Closed MrRogerHuang closed 4 years ago
Additionally, this is how to run the example https://github.com/MrMYHuang/SpringBootExample/commit/146f864c755f8766df43f1a44141ee0853d9f194:
./gradlew build
code .
@MrRogerHuang great job! I encountered this problem too!
I developed a Gradle plugin, which can acquire a Gradle project information including classpaths: https://github.com/MrRogerHuang/GradleProjectInfoPlugin It also correctly acquires classpaths if a Gradle project modifies the Java plugin default source sets properties: https://docs.gradle.org/current/userguide/java_plugin.html#sec:source_set_properties For example, if a Gradle project build.gradle has this
sourceSets {
main.output.resourcesDir = 'xyz'
}
The build resource path will be xyz instead of the default build/resource/main! My plugin can correctly acquire the nondefault resource path.
My plugin might be able to replace the code https://github.com/fwcd/kotlin-debug-adapter/blob/c987ae2c3ce5e6e50103ec5f05bc7de62525ec30/adapter/src/main/kotlin/org/javacs/ktda/classpath/ProjectClassesResolver.kt#L10 and the code https://github.com/fwcd/kotlin-language-server/blob/master/shared/src/main/kotlin/org/javacs/kt/classpath/GradleClassPathResolver.kt
Hope someone can integrate it to kotlin-debug-adapter and kotlin-language-server.
Spring Boot searches application.properties and templates by 4 kinds of paths:
See: https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config-application-property-files After run
./gradlew build
, application.properties is copied from src/main/resources/application.properties to build/resources/main. Thus, I use the 4th method to let Spring Boot loads application.properties. Path build/resources/main is added as a classpath to kotlin-debug-adapter.The modified kotlin-debug-adapter works well with debugging this Spring Boot example by "launch": https://github.com/MrMYHuang/SpringBootExample/commit/146f864c755f8766df43f1a44141ee0853d9f194 It might also fix the issue #37.