我在使用Netbeans Scala 插件时遇到问题。运行我的项目时出现以下错误:
> ant -f /Volumes/Z/Users/vincent/Dropbox/Programming/Scala/U4Handler run Could not load definitions from resource scala/tools/ant/antlib.xml. It could not be found. init: deps-jar:
> /Volumes/Z/Users/vincent/Dropbox/Programming/Scala/U4Handler/nbproject/build-impl.xml:405:
> The following error occurred while executing this line:
> /Volumes/Z/Users/vincent/Dropbox/Programming/Scala/U4Handler/nbproject/build-impl.xml:238:
> Problem: failed to create task or type scalac Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any <presetdef>/<macrodef> declarations have taken place.
> BUILD FAILED (total time: 0 seconds)
首先,我不知道为什么它与参数一起运行ant -f
,我在这个项目中不使用 Ant。其次,这是我为修复此错误所做的:
- 添加到
-J-Dscala.home=/usr/local/Cellar/scala/2.10.1/libexec/bin
netbeans.conf 中的 netbeans_default_options,我相信这是 scalac 二进制文件的实际路径(我使用 brew 安装了 scala) - 创建
~/.MacOSX/environment.plist
包含(之后重新启动):
<plist version="1.0"> <dict> <key>SCALA_HOME</key> <string>/usr/local/Cellar/scala/2.10.1/libexec/bin</string> <key>PATH</key> <string>/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/Cellar/scala/2.10.1/libexec/bin</string> </dict> </plist>'
任何帮助是极大的赞赏!!