I am trying to set up Fitnesse on my current project.
pom.xml configuration has:
<!-- https://mvnrepository.com/artifact/org.fitnesse/fitnesse -->
<dependency>
<groupId>org.fitnesse</groupId>
<artifactId>fitnesse</artifactId>
<version>20161106</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.fitnesse.plugins</groupId>
<artifactId>maven-classpath-plugin</artifactId>
<version>1.9</version>
<scope>runtime</scope>
</dependency>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>start-fitnesse</id>
<phase>test</phase>
<configuration>
<tasks>
<echo taskname="fitnesse" message="Starting FitNesse..." />
<java classname="fitnesseMain.FitNesseMain" classpathref="maven.runtime.classpath" fork="true">
<arg line="-p 8000" />
<arg line="-d ." />
</java>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Without creating the plugins.properties, i am able to bring up the fitnesse server. But, I have to bring in the maven dependencies to run fitnesse tests for which I created a plugins.properties file next to pom.xml. The plugins.properties has:
SymbolTypes = fitnesse.wikitext.widgets.MavenClasspathSymbolType
Now when I add this file, I get the following error while starting the server:
main:
[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.main(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.<init>(Annotations.java:104)
[java] at com.google.inject.internal.Annotations.<clinit>(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.<clinit>(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.<init>(DefaultPlexusContainer.java:196)
[java] at org.codehaus.plexus.DefaultPlexusContainer.<init>(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.<init>(MavenClasspathExtractor.java:51)
[java] at fitnesse.wikitext.widgets.MavenClasspathSymbolType.<init>(MavenClasspathSymbolType.java:39)
[java] ... 14 more
[java] Java Result: 1
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.552 s
[INFO] Finished at: 2018-03-27T12:58:00-04:00
[INFO] Final Memory: 29M/500M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "fitnesse" could not be activated because it does not exist.
What do I have to do get Fitnesse working ?
You probably have another library on your runtime classpath that uses a newer version of guice than used by the maven classpath plugin. I had something similar when I placed selenium on the classpath when running tests: that broke the maven classpath plugin.
I now use two strategies to run fitnesse tests:
java -jar fitness-standalone.zip -p 8000
) and I place the plugin's jar with dependencies (maven classifier 'jar-with-dependencies') in a 'plugins' subdirectory. That way none of my fixture's dependencies are on the wiki's classpath (the wiki starts a new JVM, with a classpath generated by the maven plugin, to run the fixtures, in which the maven classpath plugin is not used). So there are no conflicts with dependencies.fitnesse.wikitext.widgets.MavenClasspathSymbolType.Disable
totrue
. Then the wiki does understand the!pom
symbol in the wiki, but the plugin itself is does not try to figure out all maven dependencies, preventing the exception you encountered.Full details can be found in the pom.xml of my FitNesse fixtures/project baseline. And a sample using that baseline to take care of all this is available as a separate project.