Fitnesse maven-classpath-plugin与Guava jar冲突
我正在尝试在我的项目中设置Fitnesse,但我正面临一些与Guava jar有关的问题这就是我的pom.xml的样子:
com.google.guava guava 23.0 org.fitnesse fitnesse 20161106 runtime org.fitnesse.plugins maven-classpath-plugin 1.9 runtime integration-test false standalone true maven-antrun-plugin 1.6 start-fitnesse test run
我正在使用maven-classpath-plugin
在Fitnesse中设置类路径。 这个插件传递使用org.sonatype.sisu:sisu-guava:jar:0.9.9:runtime
jar。 而且我的项目也需要番石榴jar。 Maven依赖树:
[INFO] --- maven-dependency-plugin:3.0.1:tree (default-cli) @ testProject --- [INFO] com.rdm:testProject:jar:1.0-SNAPSHOT [INFO] +- com.google.guava:guava:jar:23.0:compile [INFO] | +- com.google.code.findbugs:jsr305:jar:1.3.9:compile [INFO] | +- com.google.errorprone:error_prone_annotations:jar:2.0.18:compile [INFO] | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile [INFO] | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile [INFO] +- org.fitnesse:fitnesse:jar:20161106:runtime [INFO] | +- org.htmlparser:htmlparser:jar:2.1:runtime [INFO] | +- org.htmlparser:htmllexer:jar:2.1:runtime [INFO] | +- org.apache.velocity:velocity:jar:1.7:runtime [INFO] | +- commons-lang:commons-lang:jar:2.6:runtime [INFO] | +- commons-collections:commons-collections:jar:3.2.2:runtime [INFO] | +- org.json:json:jar:20151123:runtime [INFO] | +- com.googlecode.java-diff-utils:diffutils:jar:1.3.0:runtime [INFO] | +- org.apache.ant:ant:jar:1.9.6:runtime [INFO] | | \- org.apache.ant:ant-launcher:jar:1.9.6:runtime [INFO] | \- junit:junit:jar:4.12:runtime [INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:runtime [INFO] \- org.fitnesse.plugins:maven-classpath-plugin:jar:1.9:runtime [INFO] \- org.apache.maven:maven-embedder:jar:3.0.4:runtime [INFO] +- org.apache.maven:maven-settings:jar:3.0.4:runtime [INFO] +- org.apache.maven:maven-core:jar:3.0.4:runtime [INFO] | +- org.apache.maven:maven-model:jar:3.0.4:runtime [INFO] | +- org.apache.maven:maven-settings-builder:jar:3.0.4:runtime [INFO] | +- org.apache.maven:maven-repository-metadata:jar:3.0.4:runtime [INFO] | +- org.apache.maven:maven-artifact:jar:3.0.4:runtime [INFO] | +- org.apache.maven:maven-aether-provider:jar:3.0.4:runtime [INFO] | | \- org.sonatype.aether:aether-spi:jar:1.13.1:runtime [INFO] | +- org.sonatype.aether:aether-impl:jar:1.13.1:runtime [INFO] | +- org.sonatype.aether:aether-api:jar:1.13.1:runtime [INFO] | +- org.sonatype.aether:aether-util:jar:1.13.1:runtime [INFO] | \- org.codehaus.plexus:plexus-interpolation:jar:1.14:runtime [INFO] +- org.apache.maven:maven-plugin-api:jar:3.0.4:runtime [INFO] +- org.apache.maven:maven-model-builder:jar:3.0.4:runtime [INFO] +- org.apache.maven:maven-compat:jar:3.0.4:runtime [INFO] | \- org.apache.maven.wagon:wagon-provider-api:jar:2.2:runtime [INFO] +- org.codehaus.plexus:plexus-utils:jar:2.0.6:runtime [INFO] +- org.codehaus.plexus:plexus-classworlds:jar:2.4:runtime [INFO] +- org.sonatype.sisu:sisu-inject-plexus:jar:2.3.0:runtime [INFO] | \- org.sonatype.sisu:sisu-inject-bean:jar:2.3.0:runtime [INFO] | \- org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0:runtime [INFO] | \- org.sonatype.sisu:sisu-guava:jar:0.9.9:runtime [INFO] +- org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:runtime [INFO] +- org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:runtime [INFO] +- org.sonatype.plexus:plexus-cipher:jar:1.7:runtime [INFO] \- commons-cli:commons-cli:jar:1.2:runtime
这是我尝试启动fitnesse服务器时出现的错误:
[fitnesse] Starting FitNesse... [java] SEVERE: Error while starting the FitNesse [Unable to instantiate component for type fitnesse.wikitext.widgets.MavenClasspathSymbolType] [java] fitnesse.components.ComponentInstantiationException: Unable to instantiate component for type fitnesse.wikitext.widgets.MavenClasspathSymb olType [java] at fitnesse.components.ComponentFactory.createComponent(ComponentFactory.java:75) [java] at fitnesse.plugins.PropertyBasedPluginFeatureFactory$8.register(PropertyBasedPluginFeatureFactory.java:152) [java] at fitnesse.plugins.PropertyBasedPluginFeatureFactory.forEachClass(PropertyBasedPluginFeatureFactory.java:144) [java] at fitnesse.plugins.PropertyBasedPluginFeatureFactory.forEachObject(PropertyBasedPluginFeatureFactory.java:150) [java] at fitnesse.plugins.PropertyBasedPluginFeatureFactory.registerSymbolTypes(PropertyBasedPluginFeatureFactory.java:75) [java] at fitnesse.plugins.PluginsLoader.loadSymbolTypes(PluginsLoader.java:87) [java] at fitnesse.ContextConfigurator.makeFitNesseContext(ContextConfigurator.java:151) [java] at fitnesseMain.FitNesseMain.launchFitNesse(FitNesseMain.java:69) [java] at fitnesseMain.FitNesseMain.launchFitNesse(FitNesseMain.java:58) [java] at fitnesseMain.FitNesseMain.mai [java] n(FitNesseMain.java:38) [java] Caused by: java.lang.reflect.InvocationTargetException [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [java] at java.lang.reflect.Constructor.newInstance(Constructor.java:408) [java] at fitnesse.components.ComponentFactory.createComponent(ComponentFactory.java:72) [java] ... 9 more [java] Caused by: java.lang.NoSuchMethodError: com.google.common.collect.MapMaker.makeComputingMap(Lcom/google/common/base/Function;)Ljava/util/c oncurrent/ConcurrentMap; [java] at com.google.inject.internal.Annotations$AnnotationChecker.(Annotations.java:104) [java] at com.google.inject.internal.Annotations.(Annotations.java:122) [java] at com.google.inject.Key.ensureRetainedAtRuntime(Key.java:362) [java] at com.google.inject.Key.strategyFor(Key.java:354) [java] at com.google.inject.Key.get(Key.java:222) [java] at org.sonatype.guice.bean.binders.ParameterKeys.(ParameterKeys.java:23) [java] at org.codehaus.plexus.DefaultPlexusContainer$ContainerModule.configure(DefaultPlexusContainer.java:801) [java] at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229) [java] at com.google.inject.spi.Elements.getElements(Elements.java:103) [java] at com.google.inject.spi.Elements.getElements(Elements.java:80) [java] at org.sonatype.guice.bean.binders.MergedModule.configure(MergedModule.java:54) [java] at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229) [java] at com.google.inject.spi.Elements.getElements(Elements.java:103) [java] at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:136) [java] at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104) [java] at com.google.inject.Guice.createInjector(Guice.java:94) [java] at com.google.inject.Guice.createInjector(Guice.java:71) [java] at com.google.inject.Guice.createInjector(Guice.java:61) [java] at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:470) [java] at org.codehaus.plexus.DefaultPlexusContainer.(DefaultPlexusContainer.java:196) [java] at org.codehaus.plexus.DefaultPlexusContainer.(DefaultPlexusContainer.java:160) [java] at fitnesse.wikitext.widgets.MavenClasspathExtractor.buildPlexusContainer(MavenClasspathExtractor.java:219) [java] at fitnesse.wikitext.widgets.MavenClasspathExtractor.buildPlexusContainer(MavenClasspathExtractor.java:215) [java] at fitnesse.wikitext.widgets.MavenClasspathExtractor.(MavenClasspathExtractor.java:51) [java] at fitnesse.wikitext.widgets.MavenClasspathSymbolType.(MavenClasspathSymbolType.java:39) [java] ... 14 more
现在,如果在maven-classpath-plugin之后声明了Guava依赖,那么我不会遇到这个问题,但是我的unit testing和集成测试失败了,而且我还是使用了MethodNotFoundException
,如果我在maven-classpath-plugin之上声明了Guava依赖,那么fitnesse服务器不会出现如上所示的错误。
我看到一个类似的问题Drools 6 sisu-guava与番石榴的冲突
任何建议或解决方案都会非常有用。
编辑:找到一个更简单的解决方案 – 我在我的pom.xml中添加了以下依赖:
org.apache.maven maven-embedder 3.5.0 runtime
这停止了sisu-guava的传递下载。 现在测试和fitnesse服务器都可以工作
这似乎与Fitnesse Maven Classpath错误非常相似。 使用我在那里提到的两种方法之一来处理wiki库和运行测试的fixture之间的依赖冲突。