Gatling pluging problems during compilation

I have a problem with running my Gatling test via mvn Gatling:test in the commandline. The following ERRORS are posted in the commandline:
09:09:25.302 [main][ERROR][ZincCompiler.scala:183] i.g.c.ZincCompiler$ - /Feeders.scala:14:5: identifier expected but ‘val’ found.
val sqlLocation: String
^
09:09:25.306 [main][ERROR][ZincCompiler.scala:183] i.g.c.ZincCompiler$ - /Feeders.scala:32:1: ‘:’ expected but ‘}’ found.
}
^
09:09:25.318 [main][WARN ][ZincCompiler.scala:185] i.g.c.ZincCompiler$ - /Feeders.scala:30:6: procedure syntax is deprecated: instead, add : Unit to ex
plicitly declare getSqlQuery's return type
}

The compiler in the Gatling plugin seems to change my code by adding a “var” in the function I’ve coded. The first codeblock is my written code and the second block is the compile code.

Written code:

def getSqlFeeder(sqlLocation:String): Feeder[Any] = {
var sqlQuery: String = “”;
Using(Source.fromFile(sqlLocation)) { source =>
sqlQuery = source.getLines().toString();
};

return jdbcFeeder(databaseUrl, username, password, sqlQuery).circular();

}

Compile code:

def getSqlQuery(val sqlLocation: String ): String {
val sqlQuery = fromFile(sqlLocation).getLines

return jdbcFeeder(databaseUrl, username, password,

queryOpvragenNatuurlijkePersonenWeinigAdressen).circular()
}

I’ve read that you can’t use “val” in a function definition in Scala. The problem is, that I’ve not added this on my own accord, but the compiler adds it. https://stackoverflow.com/questions/53226748/why-cant-i-put-val-in-function-definition-arguments-error-expected-but

As far as I can see, the compiler comes from Gatling itself. I’m using io.gatling:gatling-maven-plugin version 3.1.2 and io.gatling.highcharts:gatling-charts-highcharts version 3.6.0 while using scala 2.13.6

Is there something I’m mising or is this a bug?

P.S. These errors occured after I’ve done some refactoring to make the code more reusable. For full clarity, this is the first function written in this project. Before making the function I’ve met no problems in running the Gatling tests.

This is not a bug, neither in Gatling nor in the Scala compiler.
You’ve broken your code and most likely have unmatched opening and closing parens or curly braces.

Thank you for your response Stéphane,

Sadly neither me nor my IDE (Intellij Idea Ultimate 2021) can find unmatched opening and closing parens or curly braches. I’ll post my full object down below. Please enlighten me what I’ve done wrong and thank you for your patience.

package org.some.package

import io.gatling.core.Predef.configuration
import io.gatling.core.feeder.{Feeder, Record}
import io.gatling.jdbc.Predef.jdbcFeeder

import java.util.{Properties, UUID}
import scala.io.Source
import scala.util.Using
object Feeders {
val properties = new Properties()
properties.load(getClass.getResourceAsStream("/performance.properties"))

val databaseUrl: String = properties.getProperty(“databaseUrl”)
val username: String = properties.getProperty(“username”)
val password: String = properties.getProperty(“password”)

def getSqlFeeder(sqlLocation: String): Feeder[Any] = {
var sqlQuery: String = “”;
Using(Source.fromFile(sqlLocation)) { source =>
sqlQuery = source.getLines().toString();
};

return jdbcFeeder(databaseUrl, username, password, sqlQuery).circular();
};

def getUuidFeeder(): Iterator[Record[String]] = {
val uuidFeeder: Iterator[Record[String]] = new Feeder[String] {
override def hasNext = true;

override def next: Map[String, String] = {
Map(“uuid” → UUID.randomUUID.toString);
};
};

return uuidFeeder;
};
}

Are you sure you don’t have multiple files named Feeders?

In 09:09:25.302 [main][ERROR][ZincCompiler.scala:183] i.g.c.ZincCompiler$ - /Feeders.scala:14:5: identifier expected but ‘val’ found.

it’s /Feeders and /org/some/package/Feeders.scala

Try also cleaning the target directory.

Thank you for you quick replies Stéphane! I found the problem, and it’s indeed the problem that you suggest. I had two projects that have very similear names that both use gatling. The commandline I used was in the wrong project that I hadn’t changed yet. Sorry for the inconvenience and many thanks for your time. I’ll take my walk of shame now…