3

I am on a Mac OS X system and use Sublime Text 2 for Groovy development. When I build my file I get

/Users/it.dev/groovy-2.1.8/bin/groovy: line 31: dirname: command not found
/Users/it.dev/groovy-2.1.8/bin/groovy: line 33: /startGroovy: No such file or directory
[Finished in 0.0s with exit code 1]

I have placed the path to groovy on my /etc/launched.conf file as follows

setenv GROOVY_HOME /Users/it.dev/groovy-2.1.8
setenv PATH $PATH:$GROOVY_HOME/bin

from the command line groovy works fine. What am I doing wrong ?

Edited -

The above error disappears after correcting the PATH variable. Still get this error.

/Users/it.dev/groovy-2.1.8/bin/groovy: line 31: dirname: command not found
/Users/it.dev/groovy-2.1.8/bin/groovy: line 33: /startGroovy: No such file or directory
[Finished in 0.1s]
AGS
  • 14,288
  • 5
  • 52
  • 67
AndroidDev
  • 15,993
  • 29
  • 85
  • 119

3 Answers3

2

step 1. add a file "${Sublime-Package}/User/groovy.sublime-build" to the APPLICATION FLODER.

step 2. edit the "groovy.sublime-build" like this

{
    "cmd": ["/usr/local/groovy/bin/groovy", "$file"]
}

of course, '/usr/local/groovy' is my GROOVY_HOME, you have to use your GROOVY_HOME

step 2. restart your "sublime text 2"

step 3. open a groovy script file.

step 4. MENU -> tools -> build system -> check the "groovy"

step 5. MENU -> tools -> build (CMD + B)

Zhuo YING
  • 972
  • 3
  • 11
  • 19
1

While the other answers already describe the overall process, here is a complete configuration which works on OSX:

{
"cmd": ["groovy","$file"],
"file_regex": "[ ]*at .+[(](.+):([0-9]+)[)]",
"selector": "source.groovy",
"path": "/Path/to/your/groovy/installation:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin"
}

Note: The first part of the "path" entry is the folder in which the groovy binary is located (fill in the location of groovy on your computer). The rest of the entries are required for other commands used by sublime text.

Dude
  • 652
  • 2
  • 10
  • 24
0

I run groovy scripts on OSX (10.8) from sublime-text 2 using the following sublime build file.

{
    "cmd": ["groovy","$file"],
    "selector": "source.groovy",

    "windows":
    {
        "shell": "cmd.exe"
    }

}

The comments on this gist should help for PATH and other issues.

kdabir
  • 9,623
  • 3
  • 43
  • 45
  • I did this. The new is given in the EDIT portion of the question. I use the build file from your question and restarted Sublime Text 2. – AndroidDev Oct 27 '13 at 19:44
  • What version groovy ? And your PATH configuration please ? – AndroidDev Oct 27 '13 at 19:59
  • groovy 2.1.6. To add groovy in PATH for a application please see this SO thread http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x – kdabir Oct 28 '13 at 03:51
  • I have did this. It can find groovy but not startGroovy ? What can the problem be ? – AndroidDev Oct 28 '13 at 04:33