Following the spray template project, I've put the following sbt plugin definition into my IntelliJ 14 SBT based Scala project in project/plugins.sbt file:
addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.1")
Added Resvlver.settings to build.sbt (as per spray template build.sbt file). It is still highlighted in red, but does not fail.
Now I want to have the triggered-restart feature of sbt-revolver working. Where and how do I add the ~re-start argument in IDEA?
tl;dr You can't in IDEA 14.0.1 and earlier. I heard no plans about such support.
Related
Fly way sbt not working when sbt.version in project/build.properties is 1.2.8, but works fine when sbt.version in project/build.properties is 0.13.17.
Please find below github link of simplified project to demonstrate the issue.
https://github.com/moglideveloper/FlyWaySbtCheck
Thanks.
That happens because the (old) flyway-sbt plugin you are using is build for SBT 0.13.x only.
Have a look at the new flyway-sbt site: https://github.com/flyway/flyway-sbt
Use addSbtPlugin("io.github.davidmweber" % "flyway-sbt" % "6.2.0") in your plugin.sbt if you want to use flyway with SBT 1.x.
For some reason I am having trouble downloading the sbt-assembly plugin using
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.7")
from plugins.sbt. It says the pom is not found. I'm using scala 2.12.10 at the moment but this has been an irritation with 2.13.1, too. As an alternative, I tossed it in an artifactory repository. When sbt concocts the URL to retrieve the pom, it comes up with
http:/.../com/eed3si9n/sbt-assembly_2.12_1.0/0.14.7/sbt-assembly-0.14.7.pom
as opposed to
http:/.../com/eed3si9n/sbt-assembly/0.14.7/sbt-assembly-0.14.7.pom
which will actually retrieve it. Any insight would be appreciated.
Looking under custom resolvers in the sbt reference manual tells you to match relevant values from the build. Maybe something like:
resolvers += Resolver.url("red angus", new java.net.URL(
"http:/..."))(
Patterns("[organisation]/[module]/[revision]/[artifact]-[revision].[ext]") ).
withAllowInsecureProtocol(true)
In my Play project I notice that build.properties has sbt version addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.12")
and build.properties has sbt.version=0.13.15.
1) Why are there two enteries?
2) What is the difference between them
3) Should their versions be different?
There is a difference between SBT proper and SBT plugin. Play Framework is an SBT plugin. The version of SBT is specified in project/build.properties:
sbt.version=0.13.15
whilst the version of Play SBT plugin is specified in project/plugins.sbt:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.12")
Scala Play SBT plugin (PlayScala) is enabled in build.sbt like so:
lazy val root = (project in file(".")).enablePlugins(PlayScala)
SBT plugins enrich build definitions with additional useful tasks, commands, settings, and dependencies. Here are some examples from Play SBT plugin:
object PlayKeys {
val playDefaultPort = SettingKey[Int]("playDefaultPort", "The default port that Play runs on")
val playDefaultAddress = SettingKey[String]("playDefaultAddress", "The default address that Play runs on")
val playRunHooks = TaskKey[Seq[PlayRunHook]]("playRunHooks", "Hooks to run additional behaviour before/after the run task")
...
So for example to change the default port that Play runs on we can define in build.sbt:
PlayKeys.playDefaultPort := 9009
Note when upgrading SBT version we need to make sure it is compatible with corresponding Play SBT plugin. For example, to use Play with SBT 1 we need to update Play sbt-plugin to 2.6.6.
SBT plugin best practice artifact naming convention encurages the following naming scheme:
sbt-$projectname
For example, sbt-scoverage, sbt-buildinfo, sbt-release, sbt-assembly, however Play named it sbt-plugin, which arguably can be confusing.
I'm using the sbt-scalariform plugin with sbt, which is built with a dependency on the default version of scalariform (mdr/scalariform). I'd like it to use a different/forked version of scalariform (daniel-trinh/scalariform) for my project.
Is there a configuration I can use in sbt in my project to specify the version of scalariform I want or do I need to fork/build my own custom version of sbt-scalariform built against daniel-trinh/scalariform?
(I'm not worried about compatibility between the two versions of sbt-scalariform. sbt-scalariform is really just a wrapper.)
I can add dependencies to my project but that's for my compiled code, not the build process itself, right (Build.scala in my case)?
addSbtPlugin(org % name % version exclude (scalariformorg, scalariform))
libraryDependencies += scalariformorg % scalariformorg % version
Fill in the fields as appropriate for what you want to replace. This goes into project/plugins.sbt
I'm having problems with global plugins every once in a while, especially when I checkout another branch of my project from git. I installed sbt-dependency-graph as per their readme as a global plugin. global.sbt has a line
net.virtualvoid.sbt.graph.Plugin.graphSettings
and I am getting this annoying java.lang.NoClassDefFoundError: net/virtualvoid/sbt/graph/Plugin$ error even when I just run sbt in my project root. We also have a global plugin in a form of scala file in ~/.sbt/0.13, sometimes it causes problems as well. I haven't picked up the pattern yet.
you should install the sbt-dependency-graph plugin
step 1:
vim ~/.sbt/0.13/plugins/plugins.sbt
input:
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.5")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")
step 2:
vim ~/.sbt/0.13/global.sbt
input:
net.virtualvoid.sbt.graph.Plugin.graphSettings
now you can use dependency-graph:
sbt dependency-graph
This happened to me, and the cause was the project I had open depended on a newer and incompatible version of sbt-dependency-graph. SBT decided to put the newer on in the classpath, and so the line in my global.sbt file didn't work anymore.