我想让我的 2.11 scala 项目自动格式化。
下面的 scala 代码/src/main/scala
似乎格式正确,但是下面的 build.sbt 不是。我想对齐 %%、% 和 =>。
我的project/scalariform.sbt
:
resolvers += Resolver.typesafeRepo("releases")
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0")
我的build.sbt
:
name := "test"
version := "0.0.1-SNAPSHOT"
scalaVersion := "2.11.8"
libraryDependencies ++= {
val sparkVersion = "2.0.1"
val hadoopVersion = "2.7.0"
Seq("org.apache.spark" %% "spark-core" % sparkVersion % Provided,
"org.apache.spark" %% "spark-sql" % sparkVersion % Provided,
"org.apache.spark" %% "spark-mllib" % sparkVersion % Provided,
"org.apache.hadoop" % "hadoop-common" % hadoopVersion
)
}
resolvers ++= Seq(
"Cloudera" at "https://repository.cloudera.com/artifactory/cloudera-repos/",
)
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs@_*) => MergeStrategy.discard
case x => MergeStrategy.first
}
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import scalariform.formatter.preferences._
SbtScalariform.scalariformSettings
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(AlignParameters, true)
.setPreference(DoubleIndentClassDeclaration, true)
谢谢你的帮助