Grails ehcache插件编译错误

时间:2014-12-05 13:59:38

标签: grails ehcache

我正在尝试在我的grails应用程序中使用最新版本的grails ehcache plugin(1.0.4),但是当我在BuildConfig.groovy中添加插件作为依赖项时,我收到了编译错误启动:

| Error Compilation error: startup failed:
Compile error during compilation with javac.
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:202: error: ReloadableCacheManager.ProxyEhcache is not abstract and does not override abstract method getSearchesPerSecond() in Ehcache
                protected class ProxyEhcache implements Ehcache {
                          ^
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:805: error: getStatistics() in ReloadableCacheManager.ProxyEhcache cannot implement getStatistics() in Ehcache
                        public StatisticsGateway getStatistics()
                                                 ^
  return type StatisticsGateway is not compatible with Statistics
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:663: error: cannot find symbol
                                return getUnderlyingEhcache(name).getSearchAttributes();
                                                                 ^
  symbol:   method getSearchAttributes()
  location: interface Ehcache
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:660: error: method does not override or implement a method from a supertype
                        @Override
                        ^
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:758: error: cannot find symbol
                                return getUnderlyingEhcache(name).calculateOnDiskSize();
                                                                 ^
  symbol:   method calculateOnDiskSize()
  location: interface Ehcache
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:755: error: method does not override or implement a method from a supertype
                        @Override
                        ^
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:765: error: cannot find symbol
                                return getUnderlyingEhcache(name).getAll(arg0);
                                                                 ^
  symbol:   method getAll(Collection)
  location: interface Ehcache
  where CAP#1 is a fresh type-variable:
    CAP#1 extends Object from capture of ?
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:761: error: method does not override or implement a method from a supertype
                        @Override
                        ^
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:770: error: cannot find symbol
                                return getUnderlyingEhcache(name).hasAbortedSizeOf();
                                                                 ^
  symbol:   method hasAbortedSizeOf()
  location: interface Ehcache
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:768: error: method does not override or implement a method from a supertype
                        @Override
                        ^
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:777: error: cannot find symbol
                                getUnderlyingEhcache(name).putAll(arg0);
                                                          ^
  symbol:   method putAll(Collection)
  location: interface Ehcache
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:773: error: method does not override or implement a method from a supertype
                        @Override
                        ^
/Users/rcgeorge23/Documents/workspace/grails-cache-ehcache/src/java/grails/plugin/cache/ehcache/GrailsEhCacheManagerFactoryBean.java:783: error: method putIfAbsent in interface Ehcache cannot be applied to given types;
                                return getUnderlyingEhcache(name).putIfAbsent(arg0, arg1);
                                                                 ^
  required: Element
  found: Element,boolean

还有其他人有这个问题吗?我注意到ehcache插件仍在维护,所以我猜它适用于当前版本的grails,但我似乎无法让它为我工作。我还尝试从github中的grails-ehcache项目克隆最新的提交,并将其作为本地插件项目引用,但我仍然得到相同的编译错误。

我正在使用Grails 2.3.7。

编辑1:

我能够让我的应用程序启动使用ehcache插件的1.0.0版本,虽然我想如果我使用这个版本,我可能会错过一些重要的增强功能......

编辑2:

好的,我刚刚从github克隆了1.0.0版本,而且樱桃选择了修复TTL缺陷(https://jira.grails.org/browse/GPCACHEEHCACHE-6)。很高兴找出为什么我不能让1.0.4工作,但我现在有一个解决方法。

1 个答案:

答案 0 :(得分:0)

它适用于我的基本2.3.11应用程序,所以我猜其他东西带来了旧版本的ehcache jar。如果你运行grails dependency-report

,你可能会看到

1.0.4插件依赖于net.sf.ehcache:ehcache:2.9.0,但大多数依赖于Ehcache的其他插件尚未更新到最新版本,因此您可能会发现您还具有{{1但是版本可能会有点偏差。请注意,他们从名称中删除了“-core”,这也可能有助于此,因为除非组和名称完全相同,否则一个jar不能驱逐另一个。因此,两个人可以在类路径中同时拥有两个jar,但它们最终会以相反的顺序运行,并且它可以正常运行,因为较新的jar类被加载,而不是另一个因为加载了较旧的类。 / p>

如果暂时从

切换,您将获得更好的依赖关系报告
net.sf.ehcache:ehcache-core:2.4.8

grails.project.dependency.resolver = "maven"
grails.project.dependency.resolver = "ivy" 中的

- maven解析器只生成控制台的输出,但Ivy输出也包含HTML输出。

如果你无法解决这个问题,请创建一个小的独立测试应用程序并对其进行配置,使其失败方式相同 - 您可能只需要从应用程序中复制BuildConfig.groovy。在https://jira.grails.org/browse/GPCACHEEHCACHE创建一个问题,我会看看。如果你需要做的就是更改BuildConfig.groovy,请将其附加到问题中,否则运行BuildConfig.groovy并附上它创建的zip。