我在Scala中编辑我的Spark + Kafka应用程序,当我再次尝试编译时,我继续收到消息Failing because of negative scalastyle result
。当我更改我的版本时,我仍会收到相同的消息。
[success] created output: /home/felipe/workspace-scala-eclipse/scala-kafka-spark-demo/target
[error] java.lang.RuntimeException: Failing because of negative scalastyle result
[error] at scala.sys.package$.error(package.scala:27)
[error] at org.scalastyle.sbt.Tasks$.handleResult$1(Plugin.scala:132)
[error] at org.scalastyle.sbt.Tasks$.doScalastyleWithConfig$1(Plugin.scala:187)
[error] at org.scalastyle.sbt.Tasks$.doScalastyle(Plugin.scala:192)
[error] at org.scalastyle.sbt.ScalastylePlugin$.$anonfun$rawScalastyleSettings$3(Plugin.scala:81)
[error] at org.scalastyle.sbt.ScalastylePlugin$.$anonfun$rawScalastyleSettings$3$adapted(Plugin.scala:68)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42)
[error] at sbt.std.Transform$$anon$4.work(System.scala:64)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:257)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:266)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:257)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:32)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (*:compileScalastyle) Failing because of negative scalastyle result
[error] Total time: 1 s, completed Jan 9, 2018 10:20:46 PM
答案 0 :(得分:0)
这是因为我的项目在build.sbt上有这些配置
lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
lazy val testScalastyle = taskKey[Unit]("testScalastyle")
lazy val root = (project in file("."))
.settings(commonSettings)
.settings(scalacOptions ++= customScalacOptions)
.settings(libraryDependencies ++= customLibraryDependencies)
.settings(excludeDependencies ++= commonExcludeDependencies)
.settings(fork in run := true)
.settings(connectInput in run := true)
.settings(javaOptions in run ++= customJavaOptions)
.settings(
scalastyleFailOnError := true,
compileScalastyle := scalastyle.in(Compile).toTask("").value,
(compile in Compile) := ((compile in Compile) dependsOn compileScalastyle).value,
testScalastyle := scalastyle.in(Test).toTask("").value,
(test in Test) := ((test in Test) dependsOn testScalastyle).value)
我删除了,错误不再停止编译。
答案 1 :(得分:0)
通常可以在一个名为scalastyle-result.xml的文件中找到此错误的原因,在那里您可以找到所有警告以及可能导致此问题的错误