Micronaut HelloWorld Error: Unexpected error: Illegal name .$HelloControllerDefinition

Micronaut HelloWorld Error: Unexpected error: Illegal name .$HelloControllerDefinition

正在尝试继续演示代码 https://docs.micronaut.io/latest/guide/index.html#creatingServer

步骤如下: src/main/java/example/helloworld/HelloController.java

出现错误:

> Task :compileJava FAILED
Note: Creating bean classes for 1 type elements
error: Unexpected error: Illegal name .$HelloControllerDefinition
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
1 actionable task: 1 executed

我知道还有一个问题与此相关,但没有答案 error: Unexpected error: Illegal name .$HelloControllerDefinition

我该怎么办?

并且 hellocontroller 与文档中所说的完全相同

import io.micronaut.http.annotation.*;

@Controller("/hello") 
public class HelloController {
    @Get 
    public String index() {
        return "Hello World"; 
    }
}

HelloController 需要定义在包中。如果您完全按照指南操作,请尝试以下操作,

package example.helloworld;

import io.micronaut.http.annotation.*;

@Controller("/hello") 
public class HelloController {
    @Get 
    public String index() {
        return "Hello World"; 
    }
}