开发者

Groovy older version in Grails war

开发者 https://www.devze.com 2023-02-14 05:18 出处:网络
For some reason, \'grails war\' is including in \"WEB-INF/lib\" the \'groovy-1.6.9.jar\' and \'groovy-all-1.7.开发者_如何学JAVA8.jar\' files. I\'m working with Grails 1.3.7 and when I deploy this war

For some reason, 'grails war' is including in "WEB-INF/lib" the 'groovy-1.6.9.jar' and 'groovy-all-1.7.开发者_如何学JAVA8.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


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号