0

I wanted to integrate scalariform tool into SBT. Following the https://github.com/sbt/sbt-scalariform/tree/master I created plugins.sbt file with line

addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0")

then I created scalariform.sbt file with

scalariformSettings

Here I am stuck, when I try to run SBT for my project I am getting

scalariform.sbt:1: error: not found: value scalariformSettings

I also tried

import com.typesafe.sbt.SbtScalariform

SbtScalariform.scalariformSettings

in scalariform.sbt but then I am getting

scalariform.sbt:1: error: object typesafe is not a member of package com
import com.typesafe.sbt.SbtScalariform
           ^
scalariform.sbt:3: error: not found: value SbtScalariform
SbtScalariform.scalariformSettings
^

I saw the thread Sbt can't find SbtScalariform but it suggest changing the version to (1.1.0). Even if this worked (and it does not) I would prefer 1.3.0 version.

Community
  • 1
  • 1
Andna
  • 6,539
  • 13
  • 71
  • 120

1 Answers1

4

Is your plugin file in the correct location? For SBT 0.13.x, I have the following working:

in build.sbt

import scalariform.formatter.preferences._

name := "app"

organization := "example"

version := "0.0.0"

libraryDependencies += // ...

scalariformSettings

ScalariformKeys.preferences := ScalariformKeys.preferences.value
  .setPreference(RewriteArrowSymbols, true)
  .setPreference(AlignParameters, true)
  .setPreference(AlignSingleLineCaseStatements, true)
  .setPreference(PlaceScaladocAsterisksBeneathSecondAsterisk, true)
  .setPreference(MultilineScaladocCommentsStartOnFirstLine, true)

in project/plugins.sbt:

addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0")
Andy
  • 5,108
  • 3
  • 26
  • 37
  • Ok, that is strange. I copy-pasted your snippet w/o the part with configuration modification and removed import statement (so basically I just added `scalariformSettings` to my `build.sbt`) and now it works. The only issue left is that `IDEA` complains that it can't find symbol `scalariformSettings`. – Andna Mar 23 '14 at 00:50
  • Well, I don't know what to tell you about IDEA. – Andy Mar 23 '14 at 00:52
  • Yes, the crucial line is the `scalariformSettings` in the `build.sbt` file. After adding it I have now `scalariformFormat` task in the sbt. – The Dude Nov 29 '14 at 14:14