升级Groovy 1.7 - 2.1不兼容 [英] Upgrading Groovy 1.7 - 2.1 Incompatability

查看:95
本文介绍了升级Groovy 1.7 - 2.1不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在我的类路径中安装了java 7和Groovy 2.1所有的设置。 Gradle正在运行,我的项目可以像以前一样成功运行所有的单元测试并执行。

然而,我有一个java类加载了一个groovy类,执行它(该类可以在正常的gradle / groovy单元测试中正常执行),当我尝试在新环境中运行它时,它会失败,并出现以下异常:

 线程main中的异常java.lang.NoClassDefFoundError:org / codehaus / groovy / transform / powerassert / ValueRecorder 
at com.covestor.glossary.meta.Entity $ _Rel__clinit__closure3_closure4.doCall (Entity.groovy:500)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

我在其他问题/讨论中看到有些类从Groovy 1.7中移除了,所以一般的建议似乎是确保类是针对较新版本的groovy重新构建的 - 但是我的类已经在构建后来的版本(我的脚本,启动java代码实际上调用 gradle clean build 首先确保所有groovy类都已正确编译)。还有一些jar依赖关系,但没有一个是从Groovy源代码构建的(所有java jars)。



任何人都可以提出问题的症结所在吗?我看不到任何地方有任何代码是针对1.7版本构建的。

解决方案

ValueRecorder类在内部用于实现Groovy中的电源断言功能。不幸的是,这些类已被移动到另一个包从1.7到1.8



你的错误意味着仍然有一些1.7编译的Groovy代码。这就是NoClassDefFoundError的原因。


I am moving from Groovy 1.76 to groovy 2.1 and am having a problem running some Java code.

I have java 7 and Groovy 2.1 all setup on my classpath. Gradle is running and my project can run all its unit tests and execute successfully just as before.

However, I have one java class that loads up one of the groovy classes and executes it (the class can be executed normally in regular gradle/groovy unit tests) and when I try to run this in the new environment it fails with the following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groovy/transform/powerassert/ValueRecorder
    at com.covestor.glossary.meta.Entity$_Rel__clinit__closure3_closure4.doCall(Entity.groovy:500)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

I have seen in other questions/discussions that some classes were removed from Groovy 1.7, so the general advice seems to be to make sure the classes are re-built against a later version of groovy - but my classes are already being built against the later version (my script that kicks off the java code actually calls gradle clean build first to make sure all groovy classes are properly compiled). There are some jar dependencies as well, but none of them are built from Groovy source (all java jars).

Can anyone suggest what the problem might be? I can't see that I have any code anywhere that is still built against 1.7

解决方案

The ValueRecorder class is used internally to implement the power assert feature in Groovy. Unfortunately, these classes have been moved to another package from 1.7 to 1.8.

Your error means there is still some 1.7 compiled Groovy code. That's the reason for the NoClassDefFoundError.

这篇关于升级Groovy 1.7 - 2.1不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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