SBT plugin: Using custom source roots causes ClassNotFoundExceptions
See original GitHub issueChanging the source root breaks gatling:test
and gatling-it:test
commands.
For example, a setting such as (documented by SBT plugin: Default settings):
scalaSource in Gatling := sourceDirectory.value / "gatling" / "scala"
Will cause gatling:test
to fail with:
[error] Uncaught exception when running computerdatabase.BasicSimulation: java.lang.ClassNotFoundException: computerdatabase.BasicSimulation
[trace] Stack trace suppressed: run last gatling:test for the full output.
[info] Simulation(s) execution ended.
[error] Error during tests:
[error] computerdatabase.BasicSimulation
[error] (gatling:test) sbt.TestsFailedException: Tests unsuccessful
Everything works as expected with the scalaSource in Gatling
left unchanged and simulation sources in src/test/scala
.
Using Scala 2.11.4 (a different—but seemingly unrelated error—occurs with Scala 2.12), gatling-sbt 2.2.1, and gatling-test-framework 2.2.5.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (6 by maintainers)
Top Results From Across the Web
ClassNotFoundException trying to run my unit tests with SBT
I have a Java project that I'm building using SBT. I have a single JUnit test class. My build.sbt has the line:.
Read more >sbt/sbt - Gitter
Hello. I'm seeking advice on building a custom plugin dedicated to one project. More precisely, I would like to replace a single file...
Read more >sbt Reference Manual — Combined Pages
Supports testing with ScalaCheck, specs, and ScalaTest. JUnit is supported by a plugin. Starts the Scala REPL with project classes and dependencies on...
Read more >Play 2.7 Migration Guide - Documentation
Update the Play version number in project/plugins.sbt to upgrade Play: ... If you use a custom body parser for a file upload you...
Read more >SBT | Adventures of a space monkey
Posts about SBT written by nidkil. ... and reload a web app when a source file is changed by using the following command:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had a look, and behavior is super weird.
I tries changing
sourceDirectory in Gatling := baseDirectory.value / "src" / "gatling"
(sbt 0.13.16). Then, generated class files suddenly end up intarget/gatling-classes
instead oftarget/test-classes
. Resources files are still copied intarget/test-classes
. And test framework keeps on havingtarget/gatling-classes
in its classpath, hence the ClassNotFoundException.I’m pretty sure changing
sourceDirectory
used to work, but I have no idea when it stopped, and if it’s a bug on our side or in sbt. And we no longer have a sbt roxxor with us. If it’s an sbt bug, I’m afraid we’ll have to first upgrade our tooling to sbt 1.0, which we can’t do yet, see #3351.It would be great if some community member with sbt skills could chime in. Maybe @xuwei-k?
@HugoTigre Thanks for your help! Actually, it seems this is enough: