3

I was facing one error while trying using RootProject

I need to use gatling snapshot version which is 3.5.0-SNAPSHOT and to enable this I know two options:-

  1. using git clone and then sbt publishLocal finally using this jar as an unmanaged dependency, This works fine but it is rather more manual work, So I moved to the second option.
  2. Using sbt RootProject, so let me first explain the project setup:-

example/Build.sbt

lazy val gatling = RootProject(uri("https://github.com/gatling/gatling.git"))

lazy val root = (project in file("."))
  .settings(
    name := "example",
    version := "0.1",
    scalaVersion := "2.13.3"
  ).dependsOn(gatling)

example/project/plugins.sbt -> These two were added because it was required while building the project

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.21")

libraryDependencies += "org.scala-sbt" %% "io" % "1.4.0"

example/src/main/scala/Main.scala

import io.gatling.core.scenario.Simulation

object Main extends App {

  class A extends Simulation

  val a = new A
  println(a.toString)
}

So after this executing sbt run will result in a successful build.

But the problem starts when I tried to import gatling-highcharts in a similar fashion as:-

lazy val gatling = RootProject(uri("https://github.com/gatling/gatling.git"))

lazy val gatlingHighCharts = RootProject(uri("https://github.com/gatling/gatling-highcharts.git"))

lazy val root: Project = (project in file("."))
  .settings(
    name := "example",
    version := "0.1",
    scalaVersion := "2.13.3"
  ).dependsOn(gatling, gatlingHighCharts)

now executing sbt will result in an error as:-

[error]   not found: C:\Users\user\.ivy2\local\io.gatling\gatling-recorder\3.5.0-SNAPSHOT\ivys\ivy.xml
[error]   not found: https://repo1.maven.org/maven2/io/gatling/gatling-recorder/3.5.0-SNAPSHOT/gatling-recorder-3.5.0-SNAPSHOT.pom
[error]   not found: https://jcenter.bintray.com/io/gatling/gatling-recorder/3.5.0-SNAPSHOT/gatling-recorder-3.5.0-SNAPSHOT.pom

And this was because gatling is being used via dependsOn while actually there is nothing available to do like:-

lazy val gatlingHighCharts = RootProject(uri("https://github.com/gatling/gatling-highcharts.git")).dependsOn(gatling)

This is not possible as there is no method named dependsOn inside RootProject class and I am not able to figure out how to make that work.

Can anyone help me to figure out how can I make that work?

Plus, if somehow exist a way to use github repo jars directly as managed sources instead of unmanaged sources which is something like

libraryDependencies += "io.gatling.highcharts" % "gatling-charts-highcharts" % "3.5.0-SNAPSHOT"

without using dependsOn.

Divyanshu
  • 290
  • 2
  • 9

0 Answers0