升级Scala,Play和SBT的问题

时间:2018-08-02 18:10:09

标签: scala sbt

我有一个使用Scala的Play应用程序。当前工作版本使用:

游戏框架:2.5.18 斯卡拉(Scala):2.11.7 Sbt:0.13.11

但是当我将以上内容升级到以下版本时,一切都会中断:

游戏框架:2.6.17 Scala:2.12.6 Sbt:1.1.6

一切都中断了,我的意思是当我在IDE(Intellij)中重新加载sbt时,它失败并显示以下错误:

Error while importing sbt project:

[info] Loading settings from idea.sbt ...
[info] Loading global plugins from /Users/me/.sbt/1.0/plugins
[info] Loading project definition from /project/project
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /project
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]  * org.webjars:webjars-locator-core:0.33 is selected over 0.32
[warn]      +- com.typesafe:npm_2.12:1.2.1                        (depends on 0.32)
[warn]      +- com.typesafe.sbt:sbt-web:1.4.3 (scalaVersion=2.12, sbtVersion=1.0) (depends on 0.32)
[warn]  * org.codehaus.plexus:plexus-utils:3.0.17 is selected over {2.1, 1.5.5}
[warn]      +- org.apache.maven:maven-settings:3.2.2              (depends on 3.0.17)
[warn]      +- org.apache.maven:maven-repository-metadata:3.2.2   (depends on 3.0.17)
[warn]      +- org.apache.maven:maven-aether-provider:3.2.2       (depends on 3.0.17)
[warn]      +- org.apache.maven:maven-model:3.2.2                 (depends on 3.0.17)
[warn]      +- org.apache.maven:maven-core:3.2.2                  (depends on 3.0.17)
[warn]      +- org.apache.maven:maven-artifact:3.2.2              (depends on 3.0.17)
[warn]      +- org.apache.maven:maven-settings-builder:3.2.2      (depends on 3.0.17)
[warn]      +- org.apache.maven:maven-model-builder:3.2.2         (depends on 3.0.17)
[warn]      +- org.sonatype.plexus:plexus-sec-dispatcher:1.3      (depends on 1.5.5)
[warn]      +- org.eclipse.sisu:org.eclipse.sisu.plexus:0.0.0.M5  (depends on 2.1)
[warn]  * com.google.guava:guava:23.0 is selected over {10.0.1, 16.0, 20.0}
[warn]      +- io.methvin:directory-watcher:0.3.2                 (depends on 23.0)
[warn]      +- com.fasterxml.jackson.datatype:jackson-datatype-guava:2.8.8 (depends on 10.0.1)
[warn]      +- org.eclipse.sisu:org.eclipse.sisu.plexus:0.0.0.M5  (depends on 10.0.1)
[warn]      +- com.spotify:docker-client:8.9.0                    (depends on 10.0.1)
[warn] Run 'evicted' to see detailed eviction warnings
[error] /project/Grunt.scala:14:9: Java class java.lang.Process is not a value
[error]         Process("grunt build", base).run
[error]         ^
[error] /project/Grunt.scala:18:29: Java class java.lang.Process is not a value
[error]         watchProcess = Some(Process("grunt watch", base).run)
[error]                             ^
[error] two errors found
[error] (Compile / compileIncremental) Compilation failed
Invalid response.

如果我仅在终端中运行sbt compile,则会出现以下错误:

[info] Loading project definition from /project
[error] /project/Grunt.scala:14:9: Java class java.lang.Process is not a value
[error]         Process("grunt build", base).run
[error]         ^
[error] project/Grunt.scala:18:29: Java class java.lang.Process is not a value
[error]         watchProcess = Some(Process("grunt watch", base).run)
[error]                             ^
[error] two errors found
[error] (Compile / compileIncremental) Compilation failed
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? 

关于可能出了什么问题以及如何解决它,我确实全神贯注。版本之间是否存在不兼容问题?是因为某些东西被弃用了吗?我真的不能告诉...谷歌搜索也没有帮助。

任何有关如何解决此问题的建议,或者可能出了什么问题,将不胜感激!

更新 看着编译错误,我最初以为我已经导入了Java Process,但这是文件中的import部分,给出了编译错误:

import java.net.InetSocketAddress

import play.sbt.PlayRunHook
import sbt._

应该注意的是,所有这些在以前都运行良好。唯一的更改是升级Scala / Play / SBT

1 个答案:

答案 0 :(得分:4)

您导入了错误的Process

您已导入java.lang.Process,而您需要scala.sys.process.Process

sbt 1.0.0 release notes

中所述
  

sbt.Process和sbt.ProcessExtra被删除。请改用scala.sys.process