grails 4 groovy的日期增强方法缺失 [英] grails 4 groovy's date enhancement methods missing

查看:93
本文介绍了grails 4 groovy的日期增强方法缺失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在先前版本的grails中,我能够使用在此处找到的groovy增强版本的java.util.Date

In a previous version of grails I was able to use the groovy enhanced version of java.util.Date found here here.

升级到grails 4之后,所有这些方法都不会在java.util.Date上抛出方法签名.不知何故,常规的添加并没有被提取.

After upgrading to grails 4, all those methods throw no signature of method on java.util.Date. Somehow the groovy additions aren't being picked up.

  def fdate=new Date();
  out << fdate.format("MM/dd/yyyy")
  //No signature of method: java.util.Date.format()

推荐答案

groovy-dateutil 的依赖项添加到 build.gradle :

runtime 'org.codehaus.groovy:groovy-dateutil'

相关的扩展方法定义在 https://github.com/apache/groovy/blob/master/subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java#L526-L528 ,位于 groovy-dateutil 库中.

The relevant extension method is defined at https://github.com/apache/groovy/blob/master/subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java#L526-L528, which is in the groovy-dateutil library.

这篇关于grails 4 groovy的日期增强方法缺失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆