2

私はこのMaven依存関係を持っています...

    <dependency>
        <groupId>javanettasks</groupId>
        <artifactId>httpunit</artifactId>
        <version>1.7</version>
        <scope>test</scope>
    </dependency>

実行しているいくつかのテストでこれが必要です。このライブラリはxercesImplv2.4に依存しています。問題は、これをBamboo統合サーバーで実行すると、サーバーがより高いバージョンのxercesを使用しているため、ClassCastExceptionが発生することです。誰かが私がこれを調整する方法を知っていますか?言い換えると、テストフェーズ中にクラスローダーでxercesImplを優先させる方法はありますか?

29-Nov-2011 12:55:12    Running com.myco.clearing.product.client.xmltohtml.XmlToHtmlServiceTest
29-Nov-2011 12:55:16    Loading inherited module 'com.myco.clearing.product.ProductPlusJUnit'
29-Nov-2011 12:55:16       [ERROR] Unexpected error while processing XML
29-Nov-2011 12:55:16    java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
29-Nov-2011 12:55:16            at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
29-Nov-2011 12:55:16            at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
29-Nov-2011 12:55:16            at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<init>(Unknown Source)
29-Nov-2011 12:55:16            at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
29-Nov-2011 12:55:16            at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
29-Nov-2011 12:55:16            at com.google.gwt.dev.util.xml.ReflectiveParser.createNewSaxParser(ReflectiveParser.java:65)
29-Nov-2011 12:55:16            at com.google.gwt.dev.util.xml.ReflectiveParser.access$000(ReflectiveParser.java:46)
29-Nov-2011 12:55:16            at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:343)
29-Nov-2011 12:55:16            at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$200(ReflectiveParser.java:68)
29-Nov-2011 12:55:16            at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:418)
29-Nov-2011 12:55:16            at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:296)
29-Nov-2011 12:55:16            at com.google.gwt.dev.cfg.ModuleDefLoader$2.load(ModuleDefLoader.java:217)
29-Nov-2011 12:55:16            at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:324)
29-Nov-2011 12:55:16            at com.google.gwt.dev.cfg.ModuleDefLoader.createSyntheticModule(ModuleDefLoader.java:107)
29-Nov-2011 12:55:16            at com.google.gwt.junit.CompileStrategy.maybeCompileModuleImpl2(CompileStrategy.java:165)
29-Nov-2011 12:55:16            at com.google.gwt.junit.CompileStrategy.maybeCompileModuleImpl(CompileStrategy.java:112)
29-Nov-2011 12:55:16            at com.google.gwt.junit.SimpleCompileStrategy.maybeCompileModule(SimpleCompileStrategy.java:36)
29-Nov-2011 12:55:16            at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1340)
29-Nov-2011 12:55:16            at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1309)
29-Nov-2011 12:55:16            at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:653)
29-Nov-2011 12:55:16            at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:441)
29-Nov-2011 12:55:16            at junit.framework.TestCase.runBare(TestCase.java:134)
29-Nov-2011 12:55:16            at junit.framework.TestResult$1.protect(TestResult.java:110)
29-Nov-2011 12:55:17            at junit.framework.TestResult.runProtected(TestResult.java:128)
29-Nov-2011 12:55:17            at junit.framework.TestResult.run(TestResult.java:113)
29-Nov-2011 12:55:17            at junit.framework.TestCase.run(TestCase.java:124)
29-Nov-2011 12:55:17            at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:296)
29-Nov-2011 12:55:17            at junit.framework.TestSuite.runTest(TestSuite.java:232)
29-Nov-2011 12:55:17            at junit.framework.TestSuite.run(TestSuite.java:227)
29-Nov-2011 12:55:17            at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
29-Nov-2011 12:55:17            at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
29-Nov-2011 12:55:17            at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
29-Nov-2011 12:55:17            at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
29-Nov-2011 12:55:17            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
29-Nov-2011 12:55:17            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
29-Nov-2011 12:55:17            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
29-Nov-2011 12:55:17            at java.lang.reflect.Method.invoke(Method.java:597)
29-Nov-2011 12:55:17            at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
29-Nov-2011 12:55:17            at $Proxy0.invoke(Unknown Source)
29-Nov-2011 12:55:17            at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
29-Nov-2011 12:55:17            at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
29-Nov-2011 12:55:17            at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)

ありがとう、-デイブ

4

1 に答える 1

0

クライアント プロジェクトとサーバー プロジェクトの両方で、同じversionものを a として定義できます。dependencyこれは、Xerces への推移的な依存関係よりも優先されhttpunitます。

ただし、httpunit宣言した Xerces のバージョンと互換性がない場合は、問題が発生します。

于 2011-11-30T05:03:22.567 に答える