为什么 Groovy 的日期扩展在 Micronaut 中不可用?

Why is Groovy's date extensions not available in Micronaut?

尝试使用 Groovy 日期扩展 clearTime() 时,返回的错误是找不到匹配方法 java.util.Date#clearTime()。请检查声明的类型是否正确,方法是否存在。

当我使用时:

def date = new Date()
date.clearTime()

我得到了之前的错误。

如果我使用 compileStatic 或在运行时不使用,就会发生这种情况。

Why is Groovy's date extensions not available in Micronaut?

Groovy 的日期扩展在 Micronaut 中可用。日期扩展可以在任何 JVM 应用程序(包括 Micronaut)中使用。我希望您缺少对 groovy-dateutil 库的依赖,它是提供该方法的库。

您应该将 'org.codehaus.groovy:groovy-dateutil:3.0.5' 的依赖项添加到您的项目中。