问题
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