error: value enablePlugins is not a member of sbt.Project

Hi,

I am trying to use gatling-sbt.

In my build.sbt I have this configuration

val test = project.in(file("."))
.enablePlugins(GatlingPlugin)
.settings(resolvers += “Sonatype OSS Snapshots” at “https://oss.sonatype.org/content/repositories/snapshots”)
.settings(libraryDependencies += “io.gatling.highcharts” % “gatling-charts-highcharts” % “2.0.0-RC5” % “it,test”)
.settings(libraryDependencies += “io.gatling” % “gatling-bundle” % “2.0.0-RC5” % “test” artifacts Artifact(“gatling-bundle”, “zip”, “zip”, “bundle”))
.settings(libraryDependencies += “io.gatling” % “test-framework” % “1.0-RC5” % “it,test”)

However, I am receiving “enablePlugins is not a member of sbt.Project”

Many Thanks

Aidy

Hi,

What version of the plug-in are you using?
There is a known bug where SBT has a lot of trouble to resolve autoplugins (which Gatling is) from Maven repositories.
If you happen to depend from the snapshot version of the plug-in, please use the 1.0-RC5 version.
As RCs versions of the plug-in are published to SBT official repos and Gatling dependencies to Maven Central, you don’t need any specific resolver.

Hope this helps!

Cheers,

Pierre

Hi Pierre,

I used homebrew on OS X, and the issue is with 0.13.5. I manually installed 0.13.6 and everything worked fine. I am told the sbt version can be specified in build.properties.

Thanks

Aidy

0.13.6 added the possibility to enable autoPlugins without using a qualified project, but if it also fixes the problem with AutoPlugins published on Sonatype, that’s good to hear.
However, I strongly advise you to use the RCs of the plugins, as it reduces the amount of code needed in your SBT build : no need to specify a resolver for anything Gatling-related.
The SBT version can indeed be specified in a build.properties file : https://github.com/gatling/gatling/blob/master/project/build.properties states that we’re using 0.13.5.
It is good practice to always specify the version you’re using, to avoid being locked to the version of the SBT launcher installed on your machine (since an installed 0.13.5 SBT launcher can still download and use SBT 0.13.6).

Cheers,

Pierre

I ran into this as well,
The gatling-sbt project is built on sbt 0.13.6 and the doco reflects that by telling you to use

val test = project.in(file("."))
.enablePlugins(GatlingPlugin)

clearly if you do this in you project then you also need to use 0.13.6 in your project build.properties

I did this and it worked from the command line sbt but my Intellij had issues and kept reporting the … I removed my .idea files from the project and tried to re-open the project and I kept getting the the error you specified and intellij could now not even open a project.

It turned out that my IDE (IntelliJ) has SBT settings that were picking a bundled version of SBT 0.13.2 i think, luckily you
can point it at an external version,
I downloaded the latest 0.13.6 as a zip file , extracted it and pointed IntelliJ at the sbt-launcher.jar… problem solved.

Hope that helps

Karl

A few notes on this

I ran into this as well,
The gatling-sbt project is built on sbt 0.13.6 and the doco reflects that by telling you to use

val test = project.in(file(“.”))
.enablePlugins(GatlingPlugin)

clearly if you do this in you project then you also need to use 0.13.6 in your project build.properties

That’s not true : You need to have at least SBT 0.13, and, if my memory doesn’t fail me, more precisely 0.13.2, which added support for AutoPlugins.
You don’t need to precisely align the SBT version for your build on those of the plugins.
If it were the case, nobody would be building SBT plugins: you would need to cross-publish your plugin for every single SBT version…

I did this and it worked from the command line sbt but my Intellij had issues and kept reporting the … I removed my .idea files from the project and tried to re-open the project and I kept getting the the error you specified and intellij could now not even open a project.

It turned out that my IDE (IntelliJ) has SBT settings that were picking a bundled version of SBT 0.13.2 i think, luckily you
can point it at an external version,
I downloaded the latest 0.13.6 as a zip file , extracted it and pointed IntelliJ at the sbt-launcher.jar… problem solved.

Again, not needed. My Intellij uses the bundled SBT launcher and everything works fine.
As long as you set the SBT version to use in build.properties, any SBT 0.13 installed is able to download any other SBT 0.13 launcher and SBT libraries.
You can have a SBT 0.13.5 installed and build projects using 0.13.6 or 0.13.2 if you like.

If you’re running on anything else than Windows, I highly recommend to use Paul Philip’s SBT script from sbt-extras : https://github.com/paulp/sbt-extras
It has two major advantages :

  • You’ll never have to upgrade SBT manually, it automatically download the launcher required for your project
  • setting the SBT version in build.properties is no longer a very good practice, it would become mandatory, because that’s how the script finds which SBT launcher to download.