0

我想将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版本。

4

1 回答 1

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")
于 2014-03-23T00:33:42.790 回答