2011-03-02 100 views
1

出于某种原因,'grails war'在“WEB-INF/lib”中包含'groovy-1.6.9.jar'和'groovy-all-1.7.8.jar'文件。我与Grails的1.3.7工作,当我部署在Tomcat中这场战争,我收到以下错误:Groovy旧版Grails战争

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;

我能够部署战争的唯一方式是移除旧的常规文件,该应用程序运行良好。

我调试的依赖过程和所有我能找到的是这样的:

[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建设者/ HTTP建设者/常春藤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插件后开始发生,即使在删除它之后,问题仍然存在。

感谢

回答

9

看起来你有HTTP的建设者在你的依赖在BuildConfig.groovy阻塞。 http-builder引入groovy作为传递依赖。您需要排除它以避免与Groovy发生冲突 - 所有这些与Grails一起提供。

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

(注:上面的示例中不包括XML的API,以及,你可能想这样做,如果你在Java 6中,以避免重复类)

要追查这样的冲突,你可以使用命令:

grails dependency-report 

这下目标/依赖报告生成一个报告/

+0

我没有在BuildConfig这种依赖性。回顾结果,似乎我的应用程序具有Apache HTTPClient的这种依赖关系。无论如何,我已经按照原样添加了示例,并且使用http-builder:0.5.0和http-builder:0.5.0-RC2创建了这场战争。我想我可能会把所有的依赖都归咎于STS,但是你的回应让我朝着正确的方向正确解决这个问题。谢谢。 – Eldelshell 2011-03-03 09:34:49