我有以下Scala(2.10.1)脚本:
#!/bin/bash
export CLASSPATH=${WORKSPACE}/play-2.1.1/repository/local/play/play_2.10/2.1.1/jars/play_2.10.jar
exec ${SCALA_HOME}/bin/scala -cp ${CLASSPATH} "$0" "$@" 2>&1
!#
import play.api.libs.json.JsArray
和
$ jar tvf ${WORKSPACE}/play-2.1.1/repository/local/play/play_2.10/2.1.1/jars/play_2.10.jar | grep JsArray
1401 Sat Jun 29 18:33:36 EDT 2013 play/api/libs/json/JsArray$$anonfun$$bslash$bslash$1.class
2234 Sat Jun 29 18:33:36 EDT 2013 play/api/libs/json/JsArray$.class
1517 Sat Jun 29 18:33:38 EDT 2013 play/api/libs/json/Reads$JsArrayMonoid$.class
8358 Sat Jun 29 18:33:36 EDT 2013 play/api/libs/json/JsArray.class
1368 Sat Jun 29 18:33:36 EDT 2013 play/api/libs/json/JsArray$$anonfun$apply$1.class
6035 Sat Jun 29 18:33:36 EDT 2013 play/api/libs/json/DefaultReads$JsArrayReads$.class
但是脚本没有找到play
包而不是类:
$ ./setter-for-catan.scala
./setter-for-catan.scala:12: error: not found: object play
import play.api.libs.json.JsArray
^
one error found
发生了什么以及需要采取哪些措施来解决问题?
答案 0 :(得分:1)
编译器守护程序可能处于时髦状态。请尝试fsc -shutdown
重置它。
答案 1 :(得分:0)
我不确定原因,但以下是解决问题的方法:
#!/bin/bash
export CLASSPATH=${WORKSPACE}/play-2.1.1/repository/local/play/play_2.10/2.1.1/jars/play_2.10.jar
classpath="${CLASSPATH}"
unset CLASSPATH
exec ${SCALA_HOME}/bin/scala -cp "${classpath}" "$0" "$@" 2>&1
!#
import play.api.libs.json.JsArray