具有明确jruby依赖性的AsciidoctorJ导致IncompatibleClassChangeError

时间:2015-07-08 21:28:20

标签: grails jruby

我遵循了一些有用的建议(https://github.com/asciidoctor/asciidoctorj/issues/313#issuecomment-119372587),通过在jruby上添加明确的依赖来让asciidoctorJ在我的开发环境中工作:

compile 'org.jruby:jruby:9.0.0.0.rc1'
compile 'org.asciidoctor:asciidoctorj:1.5.2'

但是,当我将代码推送到QA环境时,我现在收到以下消息:

Caused by: java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.FieldVisitor, but class was expected
    at org.jruby.java.codegen.RealClassGenerator.defineOldStyleImplClass(RealClassGenerator.java:104)
    at org.jruby.java.codegen.RealClassGenerator.createOldStyleImplClass(RealClassGenerator.java:63)
    at org.jruby.javasupport.Java.newInterfaceImpl(Java.java:1183)
    at org.jruby.java.proxies.JavaInterfaceTemplate.jcreateProxy(JavaInterfaceTemplate.java:281)
    at org.jruby.java.proxies.JavaInterfaceTemplate.access$000(JavaInterfaceTemplate.java:30)
    at org.jruby.java.proxies.JavaInterfaceTemplate$4.call(JavaInterfaceTemplate.java:181)
    at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:661)
    at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:198)
    at org.jruby.RubyClass.finvoke(RubyClass.java:624)
    at org.jruby.runtime.Helpers.invoke(Helpers.java:500)
    at org.jruby.javasupport.JavaUtil.convertProcToInterface(JavaUtil.java:248)
    at org.jruby.RubyBasicObject.toJava(RubyBasicObject.java:800)
    at org.jruby.javasupport.JavaEmbedUtils.rubyToJava(JavaEmbedUtils.java:273)
    at org.asciidoctor.internal.RubyUtils.rubyToJava(RubyUtils.java:18)
    at org.asciidoctor.internal.JRubyAsciidoctorModuleFactory.createAsciidoctorModule(JRubyAsciidoctorModuleFactory.java:27)
    at org.asciidoctor.internal.JRubyAsciidoctor.createJRubyAsciidoctorInstance(JRubyAsciidoctor.java:123)
    at org.asciidoctor.internal.JRubyAsciidoctor.create(JRubyAsciidoctor.java:62)
    at org.asciidoctor.Asciidoctor$Factory.create(Asciidoctor.java:647)

基于研究我相信我遇到了ASM不兼容问题,但我担心我没有足够的代码库/依赖关系来获得可重现的构建。我很欣赏有关我可以采取哪些步骤来确保构建在各种环境中运行的建议。

1 个答案:

答案 0 :(得分:0)

进一步的研究使我发现这是Grails插件和jruby依赖之间的一个(愚蠢的)依赖问题。 Grails将asm-3.3.1作为grails-test-plugin的依赖项。我尝试为插件设置export = false但是很难让它工作。我的最终解决方案是添加

grails.war.resources = { stagingDir, args -> delete { fileset(file: "${stagingDir}/WEB-INF/lib/asm-3.3.*.jar") } }

到我们的BuildConfig.groovy。这让我们超越了asm依赖冲突。