sbt-scalariform plugin - can't resolve settings

♀尐吖头ヾ 提交于 2019-12-08 12:20:49

问题


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.


回答1:


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")


来源:https://stackoverflow.com/questions/22585429/sbt-scalariform-plugin-cant-resolve-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!