Issue
I've got a mixed Scala/Java maven project where the application code, unit and integration tests are written in Java but performance tests are written in Scala.
The Scala performance tests depend on a couple Java Integration Test classes that have @Data
Lombok annotations. In order for getters and setters to work I must compile JavaThenScala
, which I can do through IntelliJ Scala Compiler settings.
My question is - Is there a way I can set my maven plugins to do the JavaThenScala
compilation without adjusting the IntelliJ settings since I would like to deploy the code elsewhere?
I am trying to use the compileOrder
configuration but it doesn't seem to do the trick for me.
My maven plugins:
<build>
<plugins>
<plugin>
<groupId>met.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>4.0.0</version>
<configuration>
<compileOrder>JavaThenScala</compileOrder>
</configuration>
</plugin>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Solution
Disclaimer: Gatling founder and scala-maven-plugin co-maintainer here
Annotation processing, in particular Lombok, is a super weird beast. It seems scala-maven-plugin doesn't support it, see https://github.com/davidB/scala-maven-plugin/issues/342 (was closed due to lack of activity/contribution).
Then, I recommend you isolate your Gatling tests in a dedicated module, so you can build your Lombok based test classes in a pure Java module that would publish a test jar and then have your Gatling module depend on this test-jar.
Answered By - Stéphane LANDELLE