Closed sjmittal closed 4 years ago
Sorry for the delay.
I wonder if you have a very long classpath? It might explain why some classes are not found on Windows.
@maiflai There is indeed an issue with gradle on this: https://github.com/gradle/gradle/issues/1989
However I did a workaround for this using solutions provided in: https://stackoverflow.com/questions/40037487/the-filename-or-extension-is-too-long-error-using-gradle
Also as mentioned before when I print the classpath entries using:
configurations.testRuntime.each { println it }
I do find the jar responsible for loading org.scalatest.tools.Runner
. Maybe I am not printing classpath correctly.
Can you confirm at your end that what classpath
should get printed and right way of printing it.
There are several solutions in that link, and I think I would use different techniques to inspect the classpath in each one.
I think that you would find that exception if org.scalatest.tools.Runner
or any dependencies of it were missing, so it is not sufficient to simply check for the scalatest jar.
There are JVM options to verbosely print the discovery of classes, but it may be simpler to upgrade to Gradle 6?
@maiflai Thanks for the input. I was able to figure out what was missing in my classpath and now test cases are running fine. This can be closed.
Glad to hear it - what was the problem in the end please?
The problem was basically the pathing jar I had created to solve long classpath issue was not referencing all the dependencies and as you had pointed that it would give error for org.scalatest.tools.Runner
even if some of the dependencies are not getting loaded. That made me check if all the dependencies are getting referenced or not and it fixed the issue.
Ah, ok. Thanks very much for confirming.
Hi, I am trying to run tests, but it fails with error
Error: Could not find or load main class org.scalatest.tools.Runner
My gradle version is:
In my
build.gradle
I have defined the following settings:apply plugin: 'com.github.maiflai.scalatest'
testRuntime 'org.pegdown:pegdown:1.1.0'
Also before the execution of tests if I print the classpath entries using:
configurations.testRuntime.each { println it }
I see an entry:
org.scalatest\scalatest_2.11\3.0.0\5cd41e3452a015179356ab30de4440ae7dc999f8\scalatest_2.11-3.0.0.jar
So looks like scala test is in the class path which contains the main class that could not be found.I also see the entry
org.pegdown\pegdown\1.6.0\231ae49d913467deb2027d0b8a0b68b231deef4f\pegdown-1.6.0.jar
Is there any specific entry I need to check in my classpath to ensure all the classes are loaded?
I am confused as to why the test task is failing.
Any help please?