IntelliJ - Gradle - Kotlin - Micronaut - Changing files does not re-generate classes on “run”

一个人想着一个人 提交于 2019-12-11 00:40:04

问题


I have a Kotlin-Micronaut v.1.0.2 project in IntelliJ and with Gradle v5.3. My running application has for example the following controller:

@Controller("/api/test")
class TestController {

    @Get
    fun helloWorld() = "Hello World"
}

In case I change any of this code, for example change the return value or add another REST method (e.g. POST), the necessary code will only be generated on a ./gradlew clean build. Hitting "Run" in IntelliJ will not generate the necessary endpoints for me (e.g. on adding a POST endpoint and trying to curl it, I get "Method not allowed" until I clean build).

Do you have any suggestions?


回答1:


Enable Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Runner | Delegate IDE build/run actions to Gradle option. This way IDE will use Gradle to generate and build classes according to logic of Gradle plugins you are using.



来源:https://stackoverflow.com/questions/55824374/intellij-gradle-kotlin-micronaut-changing-files-does-not-re-generate-cla

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!