Grails 战争中的 Groovy 旧版本

发布于 2024-10-19 17:28:54 字数 1138 浏览 2 评论 0原文

由于某种原因,“grails war”包含在“WEB-INF/lib”中的“groovy-1.6.9.jar”和“groovy-all-1.7.8.jar”文件。我正在使用 Grails 1.3.7,当我在 Tomcat 中部署此战争时,我收到以下错误:

org.springframework.beans.factory.BeanCreationException: 使用名称创建 bean 时出错 'pluginManager' 定义于 ServletContext 资源 [/WEB-INF/applicationContext.xml]: 调用init方法失败; 嵌套异常是 java.lang.NoSuchMethodError: org.codehaus.groovy.control.SourceUnit.getSource()Lorg/codehaus/groovy/control/io/ReaderSource;

我能够部署战争的唯一方法是删除旧的 groovy 文件并且应用程序运行良好。

我调试了依赖过程,我能找到的就是:

[NOT REQUIRED] org.codehaus.groovy#groovy;1.6.9!groovy.jar
...
:: evicted modules:
junit#junit;3.8.2 by [junit#junit;4.8.1] in [test]
          in org.codehaus.groovy#groovy;1.6.9 with latest-revision

所以,我继续并找到文件“org.codehaus.groovy.modules.http-builder/http-builder/ivy-0.5.0-RC2.xml”,其中包含以下内容:

<dependency org="org.codehaus.groovy" name="groovy" rev="[1.5,1.6.99)"

我将此行更改为“[1.7,1.7.8)”,依赖过程工作正常,现在战争部署没有任何问题,但我以前从未接触过其中任何一个,我很担心。这是处理 Grails 依赖项的正确方法吗?

所有这一切都是在安装 JQuery UI 插件后开始发生的,即使删除它后,问题仍然存在。

谢谢

For some reason, 'grails war' is including in "WEB-INF/lib" the 'groovy-1.6.9.jar' and 'groovy-all-1.7.8.jar' files. I'm working with Grails 1.3.7 and when I deploy this war in Tomcat, I receive the following error:

org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'pluginManager' defined in
ServletContext resource
[/WEB-INF/applicationContext.xml]:
Invocation of init method failed;
nested exception is
java.lang.NoSuchMethodError:
org.codehaus.groovy.control.SourceUnit.getSource()Lorg/codehaus/groovy/control/io/ReaderSource;

The only way I'm able to deploy the war is by removing the older groovy file and the application runs fine.

I debugged the dependency process and all I could find was this:

[NOT REQUIRED] org.codehaus.groovy#groovy;1.6.9!groovy.jar
...
:: evicted modules:
junit#junit;3.8.2 by [junit#junit;4.8.1] in [test]
          in org.codehaus.groovy#groovy;1.6.9 with latest-revision

So, I continued and got to the file 'org.codehaus.groovy.modules.http-builder/http-builder/ivy-0.5.0-RC2.xml' which contains the following:

<dependency org="org.codehaus.groovy" name="groovy" rev="[1.5,1.6.99)"

I changed this line to "[1.7,1.7.8)" and the dependency process works fine and now the war deploys without any problem, but I've never touched any of this before and I'm worried. Is this the correct way to proceed with Grails dependencies?

All this started happening after installing the JQuery UI plugin and even after removing it, the problem continued.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空城旧梦 2024-10-26 17:28:54

看起来您在 BuildConfig.groovy 的依赖项块中有 http-builder 。 http-builder 将 groovy 作为传递依赖项。您需要排除它以避免与 Grails 附带的 groovy-all 发生冲突。

compile("org.codehaus.groovy.modules.http-builder:http-builder:0.5.0") {
    excludes 'groovy', 'xml-apis'
}

(注意:上面的示例也排除了 xml-api,如果您使用的是 Java 6,您可能需要这样做,以避免重复的类)

要跟踪这样的冲突,您可以使用以下命令:

grails dependency-report

该命令会在目标/依赖报告/

Looks like you have http-builder in your dependencies block in BuildConfig.groovy. http-builder pulls in groovy as a transitive dependency. You need to exclude it to avoid conflict with groovy-all shipped with Grails.

compile("org.codehaus.groovy.modules.http-builder:http-builder:0.5.0") {
    excludes 'groovy', 'xml-apis'
}

(note: the above example excludes xml-apis as well, you might want to do that if you're on Java 6, to avoid duplicate classes)

To track down conflicts like this, you can use the command:

grails dependency-report

which generates a report under target/dependency-report/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文