1

I would like to add a library that I am going to use within the code of my SBT-Plugin.

I did

...

sbtPlugin := true

libraryDependencies += "..." %% "..." % "..."

enablePlugins(SbtPlugin)

scriptedLaunchOpts := {
  scriptedLaunchOpts.value ++
    Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
}

scriptedBufferLog := false

...

in build.sbt located in the root of my plugin project.

▶ tree -L 1
.
├── README.md
├── build.sbt <- this one
├── project
└── src

But when I run the test, following: https://www.scala-sbt.org/1.x/docs/Testing-sbt-plugins.html .

I run

sbt 'set isSnapshot := true' scripted

And I am getting

java.lang.NoClassDefFoundError

with some class coming from the library I added.


Am I doing something wrong ?

Wonay
  • 1,160
  • 13
  • 35
  • 1
    Can you add the details for the scripted test? – laughedelic Apr 29 '19 at 09:58
  • can you try adding `libraryDependencies += "..." %% "..." % "..."` to the `project/plugins.sbt` file instead of your `build.sbt` file? – emran Apr 29 '19 at 16:16
  • @laughedelic I just followed the simple test from https://www.scala-sbt.org/1.x/docs/Testing-sbt-plugins.html nothing fancy. – Wonay Apr 29 '19 at 16:44
  • @terminally-chill but then it wont be available inside the src folder to use, correct ? It will only be used to help build the project itself. – Wonay Apr 29 '19 at 16:45
  • Yes. A plugin is used for the project build, it doesn't add its dependencies to the code in the project. If you want to do that, it's also possible, but it's a different thing. – laughedelic Apr 29 '19 at 22:25

0 Answers0