Migration from sbt to maven

The current project has

  • common code in src/main,
  • unit tests of that code in src/test,
  • and all the gatling integration tests in src/it.

What will be the process for finding, compiling and running those tests in the it folder? Or am I going to have to migrate the folder structure?

maven doesn’t have the notion of “configurations” like gradle and sbt have.

Do your Gatling tests have any dependency to your main and test code? Does it need to live in the same lifecycle?

If Gatling tests are isolated, IMHO, the best solutions are:

  • either move your Gatling tests into a subdirectory so they are completely isolated from your application code. This way, you have Gatling live in the same git repository and yet don’t risk mixing/messing up with your application’s classpath
  • or isolate Gatling execution into a profile where you remap the test directories:
gatling src/it/scala ${project.basedir}/src/it/resources

The entire code base is test code only. No application code.

The code in src/main is stuff like the API abstraction layer, a bunch of code that makes the tests themselves more concise to write. I only put tests in src/it because that was the standard practice for an SBT based project at the time that I first started working on it.

I could move everything into src/main. Would doing so have any unintended consequences for me? Like, would that hurt our ability to use FrontLine again ?

You can try something like this:

org.codehaus.mojo build-helper-maven-plugin 3.3.0 add-integration-test-sources generate-test-sources add-test-source src/it/scala add-integration-test-resources generate-test-resources add-test-resource src/it/resources net.alchim31.maven scala-maven-plugin ${scala-maven-plugin.version} compile testCompile -Xss100M -target:jvm-1.8 -deprecation -feature -unchecked -language:implicitConversions -language:postfixOps

However, please note that as maven actually only has main and test config, your unit tests and unit tests framework will be shipped in the Gatling Enterprise package.