sbt-scalariform插件 - 无法解析设置

时间:2014-03-23 00:17:56

标签: scala sbt scalariform

我想将scalariform工具集成到SBT中。在https://github.com/sbt/sbt-scalariform/tree/master我创建了带有行

plugins.sbt文件之后
addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0")

然后我用

创建了scalariform.sbt文件
scalariformSettings

当我尝试为我的项目运行SBT时,我陷入了困境

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

我也试过

import com.typesafe.sbt.SbtScalariform

SbtScalariform.scalariformSettings

scalariform.sbt,但后来我

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
^

我看到了帖子Sbt can't find SbtScalariform,但建议将版本更改为(1.1.0)。即使这有效(但事实并非如此),我更希望1.3.0版本。

1 个答案:

答案 0 :(得分:4)

您的插件文件位于正确的位置吗?对于SBT 0.13.x,我有以下工作:

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)
project/plugins.sbt中的

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