IntelliJ sbt找不到智能感知

时间:2018-07-28 01:39:55

标签: scala intellij-idea build sbt sbt-assembly

嗨,我只是想了解为什么我的build.sbt没有正确的突出显示。其他scala文件和.sbt文件都可以。这不是我写的项目,我对sbt感到生疏。基本上,此build.sbt中的所有变量名都突出显示为“找不到路径”,并且所有import语句都标记为未使用。请记住,我可以编译,并且可以将项目打包。只是想了解如何摆脱不良的突出显示。这是build.sbt

import scala.Some
import scala.util.matching.Regex
import scalariform.formatter.preferences._
import aether._
import sbtrelease.{ReleaseStateTransformations, _}
import sbtrelease.ReleasePlugin._
import de.johoop.findbugs4sbt.FindBugs._


name := "AcmeRevenueSummary"

scalaVersion := "2.11.11"

organization := "com.acme.prj"

description := "Acme Actions for Revenue requirement"

version in ThisBuild := "0.0.7"

parallelExecution in test := false

findbugsSettings
shellPrompt := {
  (state: State) => {
    val currProject = Project.extract(state)
    "%s:%s> ".format(
      currProject.get(name), currProject.get(version)
    )
  }
}

assemblyJarName in assembly := {
  name.value + "-" + version.value + ".jar"
}

assemblyMergeStrategy in assembly := {
  case PathList("META-INF", xs @_*) => MergeStrategy.rename
  case _ => MergeStrategy.first
}

libraryDependencies ++= Seq(
  "com.acme.da.bigdata.prj" % "ProjAction" % "1.0.20",
  "com.acme.bigdata.prj" % "KafkaUtils" % "0.0.3",
  "com.typesafe" % "config" % "1.2.1",
  "org.scala-lang" % "scala-library" % "2.11.11" % "provided",
  "org.apache.avro" % "avro" % "1.8.2",
  "com.typesafe" % "config" % "1.2.1",
  "org.everit.json" % "org.everit.json.schema" % "1.5.1",
  "org.json4s" %% "json4s-native" % "3.6.0-M2",
  "org.json4s" %% "json4s-jackson" % "3.6.0-M2",
  "org.json4s" %% "json4s-scalaz" % "3.6.0-M2",
  "org.json4s" %% "json4s-ext" % "3.6.0-M2",
  "org.mockito" % "mockito-core" % "1.10.19" % "test",
  "com.typesafe.scala-logging" %% "scala-logging" % "3.7.2",
  "com.sksamuel.avro4s" %% "avro4s-core" % "1.8.3",
  "org.slf4j" % "slf4j-api" % "1.7.7" % "test",
  "org.slf4j" % "slf4j-log4j12" % "1.7.25",
  "ch.qos.logback" % "logback-classic" % "1.1.3" % "test",
  "org.scalacheck" %% "scalacheck" % "1.13.5" % "test",
  "org.scalatest" %% "scalatest" % "3.0.3" % "test",
  "org.scalamock" %% "scalamock-scalatest-support" % "3.6.0" % "test"
)



dependencyOverrides += "com.google.guava" % "guava" % "16.0.1"

// Leave this one out of test; don't care about test code that much.
scalacOptions in Test ~= (_.filterNot(_ == "-Ywarn-value-discard"))

//dont run tests when building assembly
test in assembly := {}

//required to publish the assembly jar to nexus
artifact in(Compile, assembly) := {
  val art = (artifact in(Compile, assembly)).value
  art.copy(`classifier` = Some("assembly"))
}

addArtifact(artifact in(Compile, assembly), assembly)

// to eliminate dependency resolution warnings
updateOptions := updateOptions.value.withLatestSnapshots(false)

scalariformSettings
ScalariformKeys.preferences := FormattingPreferences()
  .setPreference(PreserveDanglingCloseParenthesis, false)
  .setPreference(RewriteArrowSymbols, false)
  .setPreference(AlignParameters, true)
  .setPreference(AlignSingleLineCaseStatements, true)
  .setPreference(CompactControlReadability, true)
  .setPreference(DoubleIndentClassDeclaration, true)
  .setPreference(CompactControlReadability, true)

scalacOptions ++= Seq(
  "-deprecation",
  "-encoding",
  "UTF-8",
  "-feature",
  "-unchecked",
  "-Xlint",
  "-Yno-adapted-args",
  "-Ywarn-dead-code",
  "-Ywarn-numeric-widen",
  "-Ywarn-value-discard",
  "-Xfuture",
  "-Ywarn-unused-import",
  "-Yinline-warnings"
)

publishTo := {
  val nexus = "http://nexus.sys.acme.com/nexus/"

  if (version.value.trim.endsWith("SNAPSHOT"))
    Some("acme-snapshots" at nexus + "content/repositories/acme-snapshots")
  else
    Some("acme-releases" at nexus + "content/repositories/acme-releases")
}

credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")

这是我的project / assembly.sbt文件

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4")

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")

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

addSbtPlugin("no.arktekk.sbt" % "aether-deploy" % "0.16")

addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.0")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5")

addSbtPlugin("de.johoop" % "findbugs4sbt" % "1.4.0")

这是我的project / build.properties文件

sbt.version = 0.13.17

0 个答案:

没有答案