Gatling Java Maven don't work

Hello!

I tried run gatling using maven but faced with issue. If i use java classes in simmulation class I get error: Caused by: java.lang.IllegalArgumentException: The requested class ‘com.testpackage.SessionSimulation’ can not be found in the classpath or does not extends Simulation.

My pom.xml:

You’ve explicitly disabled gatling-maven-plugin’s compiler. The only situation it makes sense if that you want the scala-maven-plugin to take care of compiling.

That the class was not found can only mean your maven command is wrong and doesn’t trigger scala-maven-plugin’s testCompile goal.

I tried two options:

  1. Enable gatling-maven-plugin’s compiler. Run by maven command: clean gatling:test
<build>
        <testSourceDirectory>src/test/scala</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>${scala-maven-plugin.version}</version>          
            </plugin>

            <plugin>
                <groupId>io.gatling</groupId>
                <artifactId>gatling-maven-plugin</artifactId>
                <version>${gatling.maven.version}</version>
                <configuration>
                    <simulationClass>com.testpackage.SessionSimulation</simulationClass>                                  
                </configuration>
            </plugin>
        </plugins>
    </build>

Got error: Caused by: java.lang.ClassNotFoundException: .\target\test-classes\com\testpackage\SessionSimulation


2. Disabled gatling-maven-plugin's compiler and trigger scala-maven-plugin's testCompile goal: **clean test-compile gatling:test**.

Java version?

1.8 . Via sbt works fine.

Works just fine on my side.
Must be something on your side (typo, missing .scala file extension, etc).

I created maven project using io.gatling.highcharts:gatling-highcharts-maven-archetype. Didn’t add anything else in project structure. Сan you please give an example: file structure and pom.xml.

I refactored pom.xml and everything have worked. I don’t know how :slight_smile: Excuse for troubling. Thanks for the help.