Description
We have a scenario where our local Maven repo is on a network drive. It seems to work fine for all the builds except the ones that use Cucmber JVM. It fails at runtime when we try to execute the tests. If I point the maven repo to my local machine everything works fine. I've tried it on both 1.08 and 1.09.
Here's what I have in my settings.xml:
<localRepository>\\hostname\SHARED_TOOLS\maven\repository\</localRepository>
Here is the stack trace:
[14:25:10][initializationError] cucumber.runtime.CucumberException: java.io.FileNotFoundException: E:\shared_tools\maven\repository\info\cukes\cucumber-java\1.0.8\cucumber-java-1.0.8.jar (The system cannot find the path specified)
[14:25:10][initializationError]
cucumber.runtime.CucumberException: java.io.FileNotFoundException: E:\shared_tools\maven\repository\info\cukes\cucumber-java\1.0.8\cucumber-java-1.0.8.jar (The system cannot find the path specified)
at cucumber.io.ClasspathIterable.iterator(ClasspathIterable.java:43)
at cucumber.io.ClasspathResourceLoader.getDescendants(ClasspathResourceLoader.java:31)
at cucumber.io.ClasspathResourceLoader.instantiateSubclasses(ClasspathResourceLoader.java:54)
at cucumber.runtime.Runtime.loadBackends(Runtime.java:70)
at cucumber.runtime.Runtime.<init>(Runtime.java:50)
at cucumber.junit.Cucumber.<init>(Cucumber.java:58)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:51)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:104)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)
Caused by: java.io.FileNotFoundException: E:\shared_tools\maven\repository\info\cukes\cucumber-java\1.0.8\cucumber-java-1.0.8.jar (The system cannot find the path specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:127)
at java.util.zip.ZipFile.<init>(ZipFile.java:88)
at cucumber.io.ZipResourceIterator.<init>(ZipResourceIterator.java:20)
at cucumber.io.ClasspathIterable.iterator(ClasspathIterable.java:34)
... 27 more
When I debugged it, I found on line 31 of ClasspathIterable.java, it gets a URL to the jar file. The value of that url is:
file://hostname/SHARED_TOOLS/maven/repository/info/cukes/cucumber-java/1.0.8/cucumber-java-1.0.8.jar!/cucumber/runtime
Then it calls a method called filePath(url) which has the following on line 48.
String path = new File(new URL(jarUrl.getFile()).getFile()).getAbsolutePath();
After that line, the path variable equals C:\SHARED_TOOLS\maven\repository\info\cukes\cucumber-java\1.0.8\cucumber-java-1.0.8.jar!\cucumber\runtime.
It seems that line 48 is not network-path friendly.