grails 4 groovy的日期增强方法缺失 [英] grails 4 groovy's date enhancement methods missing
问题描述
在先前版本的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屋!