Search code examples
scalasbtgatlingscala-3

How to use Gatling in a Scala 3 project


I want to use Gatling in my Scala 3 / sbt Project.

The problem is that Gatling packages its library without Version-Postfix. So I think you have the same problem for any Scala library that does that.

I tried a few things, for example:

  • Adding the dependency according to the documentation:

    libraryDependencies += "io.gatling" % "gatling-test-framework" % "3.7.2" % "test"
    
  • Gives:

    Modules were resolved with conflicting cross-version suffixes in ProjectRef(uri("file:.../"), "api"):
    com.softwaremill.quicklens:quicklens _3, _2.13
    

And

  • According to the Scala 3 Documentation:

    libraryDependencies += ("io.gatling" % "gatling-test-framework" % "3.7.2" % "test").cross(CrossVersion.for3Use2_13)
    
  • Gives:

    not found: https://repo1.maven.org/maven2/io/gatling/gatling-test-framework_2.13/3.7.2/gatling-test-framework_2.13-3.7.2.pom
    

Is there a way?


Solution

  • Not sure why but gatling-test-framework is not published with the version postfix as you said.

    This means that you don't need/can't use the for3Use2_13 as there is no 2.13 version nor 3 version: there's just a single version without postfix.

    Looking at its dependencies, version 3.7.2 targets Scala 2.13: https://mvnrepository.com/artifact/io.gatling/gatling-test-framework/3.7.2. As Scala 3 is compatible with Scala 2.13, it should be just fine with your first attempt.

    Not sure where the conflict with quicklens comes from but if it comes from Gatling dependency, you can probably exclude the _2.13 version from Gatling (or even globally) as you are pulling the _3 version yourself:

    libraryDependencies += "io.gatling" % "gatling-test-framework" % "3.7.2" % "test" exclude("com.softwaremill.quicklens" % "quicklens")