error while loading package, class file ... has location not matching its contents

So, my project compiles, runs, and passes all its unit test fine, but when I try to run my Gatling tests I get

`

mvn gatling:test
. . .
[ERROR] [2019-02-20 10:22:38,442] [main] [io.gatling.compiler.ZincCompiler$] error while loading package, class file ‘/Volumes/Repos/leaderboard/target/classes/net/kolotyluk/leaderboard/akka/package.class’ has location not matching its contents: contains package object Akka
[ERROR] [2019-02-20 10:22:38,447] [main] [io.gatling.compiler.ZincCompiler$] error while loading package, class file ‘/Volumes/Repos/leaderboard/target/classes/net/kolotyluk/leaderboard/akka/endpoint/package.class’ has location not matching its contents: contains package object endpoint
[ERROR] [2019-02-20 10:22:38,454] [main] [io.gatling.compiler.ZincCompiler$] error while loading package, class file ‘/Volumes/Repos/leaderboard/target/classes/net/kolotyluk/leaderboard/akka/endpoint/leaderboard/package.class’ has location not matching its contents: contains package object leaderboard
[ERROR] [2019-02-20 10:22:38,487] [main] [io.gatling.compiler.ZincCompiler$] three errors found

`

I cannot seem to find anything Gatling specific via Google search, but it begs the question: why does Gatling fail to compile my Scala code when Maven and IntelliJ have no problems?

Any help or insight would be appreciated.

My insight is that this is likely an SBT error, as it looks familiar.

Can anyone confirm if Gatling invokes SBT? When I run Maven with -X a lot of SBT stuff shows up in the debug output.

If Gatling relies on SBT, then it is more likely to fail.

Okay, via https://github.com/gatling/gatling/issues/3680 the problem is the Zinc compiler does not like package names with uppercase characters. Both Gatling and SBT use Zinc, which is why this problem looks familiar.

I changed the name of the package and that solved the problem.

The other solution would have been to not let Gatling compile my code, and leave that to Maven, which does not rely on Zinc.

No, the scala-maven-plugin relies on Zinc too, but a super old version.

I guess what I mean to say was that if I configure my POM with

`

<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>3.0.1</version>
<configuration>
    <disableCompiler>true</disableCompiler>
</configuration>

Enter code here…
Then I would not run into the problem with Zinc. As it is now, I am running with that, so I have to make sure that Maven compiles everything before it gets to Gatling. One way to do this is viamvn verifyinstead ofmvn gatling:test`