0

I'm trying to diagnose a failure in my ant file when it runs a Worklight task. I have a small ant file containing a simple reference to a Worklight task. This works correctly.

<target name="rawBuildApplication"  >
    <app-builder 
        applicationFolder="${applicationSource}"
        environments="mobilewebapp"
        nativeProjectPrefix="xxx"
        outputFolder="${outputFolder}"/>
</target>

However when I invoke this ant file from a build control ant file (actually from the RTC build system) I get a failure (below), showing worklight failing to find an apache Java class. I assume there's some simple environmental difference, perhaps a classpath. It might help to figure it out if I knew where Worklight loaded the apache commons from. Right now I can't see anything in my environment in the case that works that points any apache Jar.

   myAntFile.xml:146: java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.deleteQuietly(Ljava/io/File;)Z
        at com.worklight.builder.util.BuilderUtils.<clinit>(BuilderUtils.java:672)
        at com.worklight.builder.config.UserBuildConfiguration$Builder.<init>(UserBuildConfiguration.java:203)
        at com.worklight.ant.builders.ApplicationBuilderTask.createBuildConfiguration(ApplicationBuilderTask.java:149)
        at com.worklight.ant.builders.ApplicationBuilderTask.execute(ApplicationBuilderTask.java:80)

Edited: the cause is the use of -lib to add the RTC toolkit directory, exactly why this clashes and how to work around yet to be determined

4

1 回答 1

1

通常意味着您的类路径中有 commons jar 的版本,并且它覆盖了打包在 worklight-ant.jar 中的版本。apache commons 文件位于 worklight-ant.jar 文件中

来自 djna 的附加信息:我可以确认,在将 Rational Team Concert (RTC) 3.0 工具包添加到 ant 类路径时,或者使用 -lib 显式添加,或者在 RTC 构建定义中选择该选项时,一些冲突的公共 jar 被添加到类路径中. Worklight 将它需要的类打包在其 jar 中,但 -lib 文件夹似乎具有优先权。

我的解决方法是用以后的 jar 替换冲突的 jar。我用了这些罐子

commons-io-2.4.jar
commons-codec-1.8.jar
httpclient-4.2.5.jar
httpcore-4.2.4.jar
httpmime-4.2.5.jar

我想另一种选择是升级到更新的 RTC,但在我们的环境中,这目前是不可能的。

于 2013-07-02T22:58:17.583 回答