简体   繁体   中英

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

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 (eg 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 (eg on adding a POST endpoint and trying to curl it, I get "Method not allowed" until I clean build).

Do you have any suggestions?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM