Serberuss
Serberuss

Reputation: 2387

object gatling is not a member of package io

I have an existing Gatling project with Scala that I'm executing using the command line (no IDE currently). I have a need to be able to reference another external project so I am attempting to use SBT along with it, but I cannot seem to get this working.

I've referenced the following page: https://gatling.io/docs/current/extensions/sbt_plugin/ and the only real difference I've tried to make is a different directory, which appears to be correct.

I get the following error whenever I compile or run gatling:test

object gatling is not a member of package io
[error] import io.gatling.core.Predef._
[error]           ^

The issue looks to be that SBT is not picking up the Gatling project correctly. My files currently looks like this:

build.sbt

enablePlugins(GatlingPlugin)

scalaVersion := "2.12.8"

scalacOptions := Seq(
  "-encoding", "UTF-8", "-target:jvm-1.8", "-deprecation",
  "-feature", "-unchecked", "-language:implicitConversions", "-language:postfixOps")

scalaSource in Compile := baseDirectory.value / "Gatling"

libraryDependencies += "io.gatling.highcharts" % "gatling-charts-highcharts" % "3.1.3" % "test"
libraryDependencies += "io.gatling"            % "gatling-test-framework"    % "3.1.3" % "test"

plugins.sbt

addSbtPlugin("io.gatling" % "gatling-sbt" % "3.0.0")

build.properties

sbt.version=1.2.8

If you are wondering why the plugins file reference version 3.0.0 while build references 3.1.3 it's because of the version that exists on Bintray https://bintray.com/gatling/sbt-plugins/gatling-sbt/view

Any help on diagnosing this issue would be much appreciated.

Upvotes: 4

Views: 7230

Answers (2)

Subrata Ganguly
Subrata Ganguly

Reputation: 1

After keeping scala script inside the package also same issue is there, src/test/scala/com/example/FirstTest.scala

Upvotes: 0

All that you configuration, follow @Mateusz Kubuszok answer. you should move your .scala class(es) (that extends Simulation) to src/test/scala like

src/test/scala/FirstTest.scala

if it's has package like com.example then it should be

src/test/scala/com/example/FirstTest.scala

Upvotes: 5

Related Questions