Maven Dependency Conflict: org.w3c.dom.ElementTraversal

2022-09-01 08:41:24

我有一个Java代码库,它使用Maven进行依赖关系解析和在CI上运行测试。经过最近的一批开发(大到足以使识别重大更改变得困难),我的一些测试现在在通过 Maven 运行时失败,并且带有 for .当从我的IDE(IntelliJ IDEA)中运行时,相同的测试通过,因此可以按照满足所有依赖关系的方式排列类路径。NoClassDefFoundErrororg.w3c.dom.ElementTraversal

我相信xml-apis jar 1.4.01中存在(这是我所依赖的 - 请参阅下面的依赖关系树 - 就像我运行时的类路径一样),所以我不明白为什么它显然不存在。我已经尝试将xml-api 1.4.01显式添加到我的部分(在父pom中,在子pom中具有依赖项,并且排除了xml-apis上的所有其他传递依赖项),但我仍然有同样的问题,所以我开始认为我正在尝试解决错误的问题。org.w3c.dom.ElementTraversalmvn dependency:build-classpathdependencyManagement

任何人都可以建议出了什么问题,或者我如何进一步调试它?

异常堆栈跟踪

你可以看到我在Travis上得到的完整错误,但代码片段是:

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/security-app-context.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:746)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:238)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1240)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:689)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:482)
    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
    at org.eclipse.jetty.server.Server.doStart(Server.java:279)
    at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:520)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:365)
    at org.mortbay.jetty.plugin.JettyRunWarExplodedMojo.execute(JettyRunWarExplodedMojo.java:164)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycloduleBuilder.buildProject(LifecycloduleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycloduleBuilder.buildProject(LifecycloduleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativethodAccessorImpl.invoke(NativethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
    at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.startDocument(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
    at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
    ... 53 more
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
    ... 75 more

mvn 依赖项:树

故障模块的依赖关系树如下所示。您可以在GitHub(父级级)上看到完整的pom文件,但我不会在此处包含它们,以避免超过SO帖子大小限制。您可以在下面看到xml-apis位于几个位置,但Maven正在将其管理到1.4.01。

--- maven-dependency-plugin:2.1:tree (default-cli) @ xssfinder-test ---
org.xssfinder:xssfinder-test:war:1.0-SNAPSHOT
+- org.xssfinder:xssfinder-executor-java:jar:1.0-SNAPSHOT:compile
|  +- org.xssfinder:xssfinder-executor:jar:1.0-SNAPSHOT:compile
|  |  \- (org.apache.thrift:libthrift:jar:0.8.0:compile - omitted for duplicate)
|  +- org.xssfinder:xssfinder-annotations:jar:1.0-SNAPSHOT:compile
|  +- org.apache.thrift:libthrift:jar:0.8.0:compile
|  |  +- (org.slf4j:slf4j-api:jar:1.7.5:compile - version managed from 1.5.8; omitted for duplicate)
|  |  +- commons-lang:commons-lang:jar:2.5:compile
|  |  \- (org.apache.httpcomponents:httpcore:jar:4.2.2:test - version managed from 4.2.1; scope managed from compile; omitted for duplicate)
|  +- org.seleniumhq.selenium:selenium-java:jar:2.32.0:compile
|  |  +- org.seleniumhq.selenium:selenium-android-driver:jar:2.32.0:compile
|  |  |  \- org.seleniumhq.selenium:selenium-remote-driver:jar:2.32.0:compile
|  |  |     +- cglib:cglib-nodep:jar:2.1_3:compile
|  |  |     +- org.json:json:jar:20080701:compile
|  |  |     +- (org.seleniumhq.selenium:selenium-api:jar:2.32.0:compile - omitted for duplicate)
|  |  |     +- (org.apache.httpcomponents:httpclient:jar:4.2.1:compile - omitted for duplicate)
|  |  |     +- (com.google.guava:guava:jar:14.0:compile - version managed from 11.0.2; omitted for duplicate)
|  |  |     +- (org.apache.commons:commons-exec:jar:1.1:compile - omitted for duplicate)
|  |  |     +- (net.java.dev.jna:jna:jar:3.4.0:compile - omitted for duplicate)
|  |  |     \- (net.java.dev.jna:platform:jar:3.4.0:compile - omitted for duplicate)
|  |  +- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.32.0:compile
|  |  |  \- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.32.0:compile - omitted for duplicate)
|  |  +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.32.0:compile
|  |  |  +- org.seleniumhq.selenium:selenium-api:jar:2.32.0:compile
|  |  |  |  +- (com.google.guava:guava:jar:14.0:compile - omitted for duplicate)
|  |  |  |  \- (org.json:json:jar:20080701:compile - omitted for duplicate)
|  |  |  +- net.sourceforge.htmlunit:htmlunit:jar:2.12:compile
|  |  |  |  +- xalan:xalan:jar:2.7.1:compile
|  |  |  |  |  \- xalan:serializer:jar:2.7.1:compile
|  |  |  |  |     \- (xml-apis:xml-apis:jar:1.4.01:test - version managed from 1.3.04; scope managed from compile; omitted for duplicate)
|  |  |  |  +- commons-collections:commons-collections:jar:3.2.1:compile
|  |  |  |  +- org.apache.commons:commons-lang3:jar:3.1:compile
|  |  |  |  +- (org.apache.httpcomponents:httpclient:jar:4.2.3:compile - omitted for conflict with 4.2.1)
|  |  |  |  +- org.apache.httpcomponents:httpmime:jar:4.2.3:compile
|  |  |  |  |  \- (org.apache.httpcomponents:httpcore:jar:4.2.2:test - version managed from 4.2.1; scope managed from compile; omitted for duplicate)
|  |  |  |  +- commons-codec:commons-codec:jar:1.7:compile
|  |  |  |  +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.12:compile
|  |  |  |  +- xerces:xercesImpl:jar:2.10.0:compile
|  |  |  |  |  \- (xml-apis:xml-apis:jar:1.4.01:test - version managed from 1.0.b2; scope managed from compile; omitted for duplicate)
|  |  |  |  +- net.sourceforge.nekohtml:nekohtml:jar:1.9.18:compile
|  |  |  |  +- net.sourceforge.cssparser:cssparser:jar:0.9.9:compile
|  |  |  |  |  \- org.w3c.css:sac:jar:1.3:compile
|  |  |  |  +- (commons-io:commons-io:jar:2.4:compile - omitted for conflict with 2.2)
|  |  |  |  +- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate)
|  |  |  |  \- org.eclipse.jetty:jetty-websocket:jar:8.1.9.v20130131:compile
|  |  |  |     +- (org.eclipse.jetty:jetty-util:jar:8.1.9.v20130131:compile - omitted for conflict with 7.6.10.v20130312)
|  |  |  |     +- (org.eclipse.jetty:jetty-io:jar:8.1.9.v20130131:compile - omitted for conflict with 7.6.10.v20130312)
|  |  |  |     \- (org.eclipse.jetty:jetty-http:jar:8.1.9.v20130131:compile - omitted for conflict with 7.6.10.v20130312)
|  |  |  \- org.apache.httpcomponents:httpclient:jar:4.2.1:compile
|  |  |     +- (org.apache.httpcomponents:httpcore:jar:4.2.2:test - version managed from 4.2.1; scope managed from compile; omitted for duplicate)
|  |  |     +- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate)
|  |  |     \- (commons-codec:commons-codec:jar:1.6:compile - omitted for conflict with 1.7)
|  |  +- org.seleniumhq.selenium:selenium-firefox-driver:jar:2.32.0:compile
|  |  |  +- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.32.0:compile - omitted for duplicate)
|  |  |  +- commons-io:commons-io:jar:2.2:compile
|  |  |  \- org.apache.commons:commons-exec:jar:1.1:compile
|  |  +- org.seleniumhq.selenium:selenium-ie-driver:jar:2.32.0:compile
|  |  |  +- net.java.dev.jna:jna:jar:3.4.0:compile
|  |  |  +- net.java.dev.jna:platform:jar:3.4.0:compile
|  |  |  \- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.32.0:compile - omitted for duplicate)
|  |  +- org.seleniumhq.selenium:selenium-iphone-driver:jar:2.32.0:compile
|  |  |  \- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.32.0:compile - omitted for duplicate)
|  |  +- org.seleniumhq.selenium:selenium-safari-driver:jar:2.32.0:compile
|  |  |  +- (org.seleniumhq.selenium:selenium-remote-driver:jar:2.32.0:compile - omitted for duplicate)
|  |  |  \- (org.webbitserver:webbit:jar:0.4.14:compile - omitted for duplicate)
|  |  +- org.seleniumhq.selenium:selenium-support:jar:2.32.0:compile
|  |  |  \- (org.seleniumhq.selenium:selenium-api:jar:2.32.0:compile - omitted for duplicate)
|  |  \- org.webbitserver:webbit:jar:0.4.14:compile
|  |     \- io.netty:netty:jar:3.5.2.Final:compile
|  +- org.reflections:reflections-maven:jar:0.9.8:compile
|  |  +- org.reflections:reflections:jar:0.9.8:compile
|  |  |  +- com.google.guava:guava:jar:14.0:compile
|  |  |  +- javassist:javassist:jar:3.12.1.GA:compile
|  |  |  \- dom4j:dom4j:jar:1.6.1:compile
|  |  |     \- xml-apis:xml-apis:jar:1.4.01:test
|  |  +- org.jfrog.maven.annomojo:maven-plugin-anno:jar:1.4.1:compile
|  |  \- org.jfrog.jade.plugins.common:jade-plugin-common:jar:1.3.8:compile
|  |     +- (org.jfrog.maven.annomojo:maven-plugin-anno:jar:1.3.0:compile - omitted for conflict with 1.4.1)
|  |     +- ant:ant:jar:1.6.5:compile
|  |     +- org.apache.maven:maven-plugin-api:jar:2.0.5:compile
|  |     +- org.apache.maven:maven-project:jar:2.0.5:compile
|  |     |  +- org.apache.maven:maven-settings:jar:2.0.5:compile
|  |     |  |  +- (org.apache.maven:maven-model:jar:2.0.5:compile - omitted for duplicate)
|  |     |  |  +- (org.codehaus.plexus:plexus-utils:jar:1.1:compile - omitted for duplicate)
|  |     |  |  \- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9:compile - omitted for duplicate)
|  |     |  +- org.apache.maven:maven-profile:jar:2.0.5:compile
|  |     |  |  +- (org.apache.maven:maven-model:jar:2.0.5:compile - omitted for duplicate)
|  |     |  |  +- (org.codehaus.plexus:plexus-utils:jar:1.1:compile - omitted for duplicate)
|  |     |  |  \- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9:compile - omitted for duplicate)
|  |     |  +- (org.apache.maven:maven-model:jar:2.0.5:compile - omitted for duplicate)
|  |     |  +- org.apache.maven:maven-artifact-manager:jar:2.0.5:compile
|  |     |  |  +- org.apache.maven:maven-repository-metadata:jar:2.0.5:compile
|  |     |  |  |  \- (org.codehaus.plexus:plexus-utils:jar:1.1:compile - omitted for duplicate)
|  |     |  |  +- (org.codehaus.plexus:plexus-utils:jar:1.1:compile - omitted for duplicate)
|  |     |  |  +- (org.apache.maven:maven-artifact:jar:2.0.5:compile - omitted for duplicate)
|  |     |  |  +- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9:compile - omitted for duplicate)
|  |     |  |  \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
|  |     |  |     \- (org.codehaus.plexus:plexus-utils:jar:1.0.4:compile - omitted for conflict with 1.1)
|  |     |  +- (org.codehaus.plexus:plexus-utils:jar:1.1:compile - omitted for duplicate)
|  |     |  +- (org.apache.maven:maven-artifact:jar:2.0.5:compile - omitted for duplicate)
|  |     |  \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9:compile
|  |     |     +- (junit:junit:jar:4.11:test - version managed from 3.8.1; scope managed from compile; omitted for duplicate)
|  |     |     +- (org.codehaus.plexus:plexus-utils:jar:1.0.4:compile - omitted for conflict with 1.1)
|  |     |     \- classworlds:classworlds:jar:1.1-alpha-2:compile
|  |     +- org.apache.maven:maven-artifact:jar:2.0.5:compile
|  |     |  \- (org.codehaus.plexus:plexus-utils:jar:1.1:compile - omitted for duplicate)
|  |     +- org.apache.maven:maven-model:jar:2.0.5:compile
|  |     |  \- (org.codehaus.plexus:plexus-utils:jar:1.1:compile - omitted for duplicate)
|  |     +- org.codehaus.plexus:plexus-utils:jar:1.1:compile
|  |     +- xstream:xstream:jar:1.1.3:compile
|  |     \- xpp3:xpp3:jar:1.1.3.4-RC8:runtime
|  +- org.slf4j:slf4j-api:jar:1.7.5:compile
|  \- ch.qos.logback:logback-classic:jar:1.0.13:compile
|     +- ch.qos.logback:logback-core:jar:1.0.13:compile
|     \- (org.slf4j:slf4j-api:jar:1.7.5:compile - version managed from 1.5.8; omitted for duplicate)
+- org.springframework:spring-webmvc:jar:3.1.0.RELEASE:compile
|  +- org.springframework:spring-asm:jar:3.1.0.RELEASE:compile
|  +- org.springframework:spring-beans:jar:3.1.0.RELEASE:compile
|  |  \- (org.springframework:spring-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|  +- org.springframework:spring-context:jar:3.1.0.RELEASE:compile
|  |  +- (org.springframework:spring-aop:jar:3.1.0.RELEASE:compile - omitted for conflict with 3.0.6.RELEASE)
|  |  +- (org.springframework:spring-beans:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|  |  +- (org.springframework:spring-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|  |  +- (org.springframework:spring-expression:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|  |  \- (org.springframework:spring-asm:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|  +- org.springframework:spring-context-support:jar:3.1.0.RELEASE:compile
|  |  +- (org.springframework:spring-beans:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|  |  +- (org.springframework:spring-context:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|  |  \- (org.springframework:spring-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|  +- org.springframework:spring-core:jar:3.1.0.RELEASE:compile
|  |  +- (org.springframework:spring-asm:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|  |  \- commons-logging:commons-logging:jar:1.1.1:compile
|  +- org.springframework:spring-expression:jar:3.1.0.RELEASE:compile
|  |  \- (org.springframework:spring-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|  \- org.springframework:spring-web:jar:3.1.0.RELEASE:compile
|     +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
|     +- (org.springframework:spring-beans:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|     +- (org.springframework:spring-context:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|     \- (org.springframework:spring-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
+- org.springframework.security:spring-security-core:jar:3.1.0.RELEASE:compile
|  +- aopalliance:aopalliance:jar:1.0:compile
|  +- (org.springframework:spring-expression:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  +- org.springframework:spring-aop:jar:3.0.6.RELEASE:compile
|  |  +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
|  |  +- (org.springframework:spring-asm:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  |  +- (org.springframework:spring-beans:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  |  \- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  +- (org.springframework:spring-context:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  +- (org.springframework:spring-beans:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  +- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  \- org.springframework.security:spring-security-crypto:jar:3.1.0.RELEASE:compile
|     \- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
+- org.springframework.security:spring-security-config:jar:3.1.0.RELEASE:compile
|  +- (org.springframework:spring-context:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  +- (org.springframework:spring-beans:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
|  +- (org.springframework:spring-aop:jar:3.0.6.RELEASE:compile - omitted for duplicate)
|  +- (org.springframework.security:spring-security-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|  \- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
+- org.springframework.security:spring-security-web:jar:3.1.0.RELEASE:compile
|  +- org.springframework:spring-tx:jar:3.0.6.RELEASE:compile
|  |  +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
|  |  +- (org.springframework:spring-aop:jar:3.0.6.RELEASE:compile - omitted for duplicate)
|  |  +- (org.springframework:spring-beans:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  |  +- (org.springframework:spring-context:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  |  \- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  +- (org.springframework:spring-web:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
|  +- (org.springframework:spring-expression:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  +- (org.springframework:spring-aop:jar:3.0.6.RELEASE:compile - omitted for duplicate)
|  +- (org.springframework.security:spring-security-core:jar:3.1.0.RELEASE:compile - omitted for duplicate)
|  +- org.springframework:spring-jdbc:jar:3.0.6.RELEASE:compile
|  |  +- (org.springframework:spring-beans:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  |  +- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  |  \- (org.springframework:spring-tx:jar:3.0.6.RELEASE:compile - omitted for duplicate)
|  +- (org.springframework:spring-context:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  +- (org.springframework:spring-beans:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
|  \- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
+- junit:junit:jar:4.11:test
|  \- org.hamcrest:hamcrest-core:jar:1.3:test
+- org.xssfinder:xssfinder-core:jar:1.0-SNAPSHOT:test
|  +- (org.xssfinder:xssfinder-executor:jar:1.0-SNAPSHOT:test - omitted for duplicate)
|  +- (org.slf4j:slf4j-api:jar:1.7.5:test - version managed from 1.5.8; omitted for duplicate)
|  +- (ch.qos.logback:logback-classic:jar:1.0.13:test - omitted for duplicate)
|  \- (com.google.guava:guava:jar:14.0:compile - version managed from 11.0.2; scope updated from test; omitted for duplicate)
+- org.apache.httpcomponents:httpcore:jar:4.2.2:test
+- org.eclipse.jetty:jetty-server:jar:7.6.10.v20130312:compile
|  +- org.eclipse.jetty.orbit:javax.servlet:jar:2.5.0.v201103041518:compile
|  +- org.eclipse.jetty:jetty-continuation:jar:7.6.10.v20130312:compile
|  \- org.eclipse.jetty:jetty-http:jar:7.6.10.v20130312:compile
|     \- org.eclipse.jetty:jetty-io:jar:7.6.10.v20130312:compile
|        \- (org.eclipse.jetty:jetty-util:jar:7.6.10.v20130312:compile - omitted for duplicate)
+- org.eclipse.jetty:jetty-servlet:jar:7.6.10.v20130312:compile
|  \- org.eclipse.jetty:jetty-security:jar:7.6.10.v20130312:compile
|     \- (org.eclipse.jetty:jetty-server:jar:7.6.10.v20130312:compile - omitted for duplicate)
+- org.eclipse.jetty:jetty-webapp:jar:7.6.10.v20130312:compile
|  +- org.eclipse.jetty:jetty-xml:jar:7.6.10.v20130312:compile
|  |  \- (org.eclipse.jetty:jetty-util:jar:7.6.10.v20130312:compile - omitted for duplicate)
|  \- (org.eclipse.jetty:jetty-servlet:jar:7.6.10.v20130312:compile - omitted for duplicate)
+- org.eclipse.jetty:jetty-servlets:jar:7.6.10.v20130312:compile
|  +- (org.eclipse.jetty:jetty-continuation:jar:7.6.10.v20130312:compile - omitted for duplicate)
|  +- org.eclipse.jetty:jetty-client:jar:7.6.10.v20130312:compile
|  |  \- (org.eclipse.jetty:jetty-http:jar:7.6.10.v20130312:compile - omitted for duplicate)
|  \- org.eclipse.jetty:jetty-util:jar:7.6.10.v20130312:compile
+- org.eclipse.jetty:jetty-jsp:jar:7.6.10.v20130312:compile
|  +- org.eclipse.jetty.orbit:javax.servlet.jsp:jar:2.1.0.v201105211820:compile
|  |  \- (org.eclipse.jetty.orbit:javax.servlet:jar:2.5.0.v201103041518:compile - omitted for duplicate)
|  +- org.eclipse.jetty.orbit:org.apache.jasper.glassfish:jar:2.1.0.v201110031002:compile
|  |  +- (org.eclipse.jetty.orbit:javax.servlet:jar:2.5.0.v201103041518:compile - omitted for duplicate)
|  |  \- (org.eclipse.jetty.orbit:javax.servlet.jsp:jar:2.1.0.v201105211820:compile - omitted for duplicate)
|  +- org.eclipse.jetty.orbit:javax.servlet.jsp.jstl:jar:1.2.0.v201105211821:compile
|  |  +- (org.eclipse.jetty.orbit:javax.servlet:jar:2.5.0.v201103041518:compile - omitted for duplicate)
|  |  \- (org.eclipse.jetty.orbit:javax.servlet.jsp:jar:2.1.0.v201105211820:compile - omitted for duplicate)
|  +- org.eclipse.jetty.orbit:org.apache.taglibs.standard.glassfish:jar:1.2.0.v201112081803:compile
|  |  \- (org.eclipse.jetty.orbit:javax.servlet.jsp.jstl:jar:1.2.0.v201105211821:compile - omitted for duplicate)
|  +- org.eclipse.jetty.orbit:javax.el:jar:2.1.0.v201105211819:compile
|  +- org.eclipse.jetty.orbit:com.sun.el:jar:1.0.0.v201105211818:compile
|  \- org.eclipse.jetty.orbit:org.eclipse.jdt.core:jar:3.7.1:compile
\- javax.servlet:jstl:jar:1.2:provided

答案 1

在我的情况下,通过将xml-apis的版本从1.3.04更改为1.4.01,问题得到了解决。


答案 2

看起来好像你没有在孩子pom中指定的依赖关系。该部分不会导致包含依赖项,它只是提供可以继承的配置。看起来你的子pom中的一些依赖项正在传递,但是对于一些奇怪的Maven怪癖,获胜的那个(版本1.4.01)在测试范围内;据推测,它位于测试范围内,无论哪个依赖项指定它。在 pom 中指定它们的测试作用域中的传递依赖项不会被测试作用域中的项目依赖项拉入 - 这是一个非常棘手的句子,需要解析,但是对依赖项作用域有一个很好的解释,可能会使事情变得更清晰。xml-apis<dependencyManagement>xml-apis

从本质上讲,我正在查看的是您的依赖关系树,它显示了 一个包含的版本,如以下编辑版本的输出所示:xml-apis

org.xssfinder:xssfinder-test:war:1.0-SNAPSHOT
+- org.xssfinder:xssfinder-executor-java:jar:1.0-SNAPSHOT:compile
   +- org.reflections:reflections-maven:jar:0.9.8:compile
      +- org.reflections:reflections:jar:0.9.8:compile
         +- com.google.guava:guava:jar:14.0:compile
         +- javassist:javassist:jar:3.12.1.GA:compile
         \- dom4j:dom4j:jar:1.6.1:compile
            \- xml-apis:xml-apis:jar:1.4.01:test

我不完全确定为什么会将其作为测试范围,但我猜这就是问题所在。我建议将依赖项显式添加到你的子 pom 中,看看它是否会影响依赖项树 - 你试图避免将其作为传递依赖项拉入,看看你是否可以解决问题。xml-apis


推荐