ãã¡ãã®è¨äºã§ãGroovy ãã¤ã³ã¹ãã¼ã«ãã¦ããªãç°å¢ã§ Groovy ã¹ã¯ãªãããå®è¡ããæ¹æ³ãæ¸ããã¦ã¾ãããããã®æ¹æ³ã§ã¯ãã¹ã¯ãªããã®å®è¡ã«å¿ è¦ãª Groovy 㨠Ivy*1 ã® Jar ãã¡ã¤ã«èªä½ã¯å®è¡è ã«ç¨æãã¦ãããå¿ è¦ãããã¾ããã
æè¿ãClojure ã®åå¼·ã«ã¨æã£ã¦ Leiningen ã¨ãããã¼ã«ãã¤ã¸ã£ã¦ããã§ãã*2ããã®ãã¼ã«ã§ã¯ Clojure ã® Jar ã¯ãã¡ãããLeiningen ã® Jar ããããã¼ã«ã«ãã£ã¦ãã¦ã³ãã¼ããã¡ãããï¼ã£ã¦ãã¤ã§ãã¦ã¼ã¶ã¼ããã¦ã³ãã¼ãããå¿ è¦ãããã®ã¯ã·ã§ã«ã»ã¹ã¯ãªããï¼*nixãMac ä¸ï¼ãããã¯ãããã»ãã¡ã¤ã«ï¼Windowsï¼ã ããã¨ããæ軽極ã¾ããªãï¼ï¼ï¼ã¦ã¼ã¶ããªãã£ã¨ãªã£ã¦ããã¾ããããã§ããããã¡ãã£ã¨ Groovy ã¹ã¯ãªããã®å®è¡ã«å¿ç¨ãã¦ã¿ããï¼ã¨è©¦è¡é¯èª¤ãã¦ã¿ã¾ãããã以ä¸ãWindows ã®è©±ã§ããããããããã¶ã win32 ç³»ã®ã¿ã
åè
- ãä½æããGroovyã¹ã¯ãªãããGroovyæªã¤ã³ã¹ãã¼ã«ç°å¢ã§ä½¿ã£ã¦ãããã
- ãWget for Windowsã
- ãWGET for Windows (win32)ã
- ãLeiningenã
æºå
ããã§è¡ãæ¹æ³ã¨åèè¨äºãä½æããGroovyã¹ã¯ãªãããGroovyæªã¤ã³ã¹ãã¼ã«ç°å¢ã§ä½¿ã£ã¦ããããã§è¡ã£ã¦ããæ¹æ³ã¨ã®éãã¯ãå¿ è¦ãª Jar ãã¡ã¤ã«ï¼groovy-all-x.x.x.jar, ivy-x.x.x.jarï¼ãããããã¡ã¤ã«ãããã¦ã³ãã¼ããã¦ãããï¼ã£ã¦ã¨ããã§ããããã®ããã«ã¯ OS ãã¤ãã£ããªãã¼ã«ã使ããªãã¨ãããªãã®ãé£ç¹*3ãããã®è¾ºãã WORA ãä¿¡æ¡ã¨ãã Java ããã°ã©ãã«ã¯åã£ã¤ãã«ããã¨ããããã¾ãææ ¢ã
Leiningen ã§ã¯ Leiningen ã® Jar ãã¡ã¤ã«ããã¦ã³ãã¼ãããã®ã« wget ã¨ãããã¼ã«ï¼ã³ãã³ãï¼ã使ã£ã¦ã¾ãããWindows ã§ã¯ããã©ã«ãã§ä½¿ç¨ã§ããªãã®ã§ãã¾ããã®ãã¼ã«ãã¤ã³ã¹ãã¼ã«ããªããã°ããã¾ãããããããã§ããã°ãå¾ã¯ããããã¡ã¤ã«ãå®è¡ããã ãã§ãã
wget ã®ã¤ã³ã¹ãã¼ã«
wget ã¯ä»¥ä¸ã®ãµã¤ã
ãã exe ãã¡ã¤ã«ããã¦ã³ãã¼ãåºæ¥ã¾ãããç´ã§ exe ãã¡ã¤ã«ãç½®ããã¦ãã®ãã¡ãã£ã¨ã³ã¯ã¤ã§ããwã使ç¨æ¹æ³ãã©ã¤ã»ã³ã¹ãã¾ã¨ãã zip ãã¡ã¤ã«ã¯
- ãWget for Windowsã
ããåå¾ã§ãã¾ããããã® zip ãã¡ã¤ã«ãå±éã㦠bin ãã©ã«ãã«ãã wget.exe ã使ã£ã¦ãæ§ãã¾ããã
ã¨ãããããã® wget.exe ãã¡ã¤ã«ã PATH ä¸ããããã¯å®è¡ããã Groovy ã¹ã¯ãªããã¨åããã©ã«ãä¸ã«é ç½®ãã¾ãããwget ã®ã¤ã³ã¹ãã¼ã«ã¯ããã ã*4ã
ããããã¡ã¤ã«ã®é å
次ã¯ããããã¡ã¤ã«ã®é åããã¨ãã£ã¦ãã以ä¸ã®ãã¡ã¤ã«
- qroovy.bat ãï¼âãgroovy.batãã§ã¯ãªããqroovy.batãããï¼
ããã¦ã³ãã¼ããã¦ãwget.exe ã¨åæ§ã« PATH ä¸ãããã¯å®è¡ããã Groovy ã¹ã¯ãªããã¨åããã©ã«ãä¸ã«ç½®ãã¾ãããã¡ãªã¿ã«ããããã¡ã¤ã«ã®å 容ã¯ãããªã®ï¼
@echo off :: Configurable variables if "%GROOVY_VERSION%" == "" set GROOVY_VERSION=2.0.1 if "%IVY_VERSION%" == "" set IVY_VERSION=2.2.0 if "%QROOVY_REPO%" == "" set QROOVY_REPO=%USERPROFILE%\.qroovy if "%JAVA_CMD%" == "" set JAVA_CMD="java" if "%JVM_OPTS%" == "" set JVM_OPTS=%JAVA_OPTS% setLocal EnableExtensions EnableDelayedExpansion :: Fixed variables set GROOVY_JAR=!QROOVY_REPO!\groovy-all-!GROOVY_VERSION!.jar set GROOVY_JAR_URL=http://repo1.maven.org/maven2/org/codehaus/groovy/groovy-all/%GROOVY_VERSION%/groovy-all-%GROOVY_VERSION%.jar set IVY_JAR=!QROOVY_REPO!\ivy-!IVY_VERSION!.jar set IVY_JAR_URL=http://repo1.maven.org/maven2/org/apache/ivy/ivy/%IVY_VERSION%/ivy-%IVY_VERSION%.jar set ORIGINAL_PWD=%CD% :: If ORIGINAL_PWD ends with a backslash (such as C:\), :: we need to escape it with a second backslash. if "%ORIGINAL_PWD:~-1%x" == "\x" set "ORIGINAL_PWD=%ORIGINAL_PWD%\" :: Download jar files if not exists. for %%f in ("%GROOVY_JAR%") do set QROOVY_REPO="%%~dpf" if not exist %QROOVY_REPO% mkdir %QROOVY_REPO% set HTTP_CLIENT=wget --no-check-certificate -O wget>nul 2>&1 if ERRORLEVEL 9009 ( curl>nul 2>&1 if ERRORLEVEL 9009 goto NO_HTTP_CLIENT set HTTP_CLIENT=curl --insecure -f -L -o ) if not exist "%GROOVY_JAR%" ( echo Downloading Groovy now... %HTTP_CLIENT% "%GROOVY_JAR%" %GROOVY_JAR_URL% if ERRORLEVEL 1 ( del %GROOVY_JAR%>nul 2>&1 echo. echo Failed to download %GROOVY_JAR_URL% echo. goto EOF ) ) if not exist "%IVY_JAR%" ( echo Downloading ivy now... %HTTP_CLIENT% "%IVY_JAR%" %IVY_JAR_URL% if ERRORLEVEL 1 ( del %IVY_JAR%>nul 2>&1 echo. echo Failed to download %IVY_JAR_URL% echo. goto EOF ) ) goto RUN :NO_HTTP_CLIENT echo. echo ERROR: Wget/Curl not found. Make sure at least either of Wget and Curl is echo installed and is in PATH. You can get them from URLs below: echo. echo Wget: "http://users.ugent.be/~bpuype/wget/" echo Curl: "http://curl.haxx.se/dlwiz/?type=bin&os=Win32&flav=-&ver=2000/XP" echo. goto EOF :RUN if not "%DEBUG%" == "" echo CLASSPATH=!CLASSPATH! :: ################################################## setLocal DisableDelayedExpansion %JAVA_CMD% %JVM_OPTS% -cp "%GROOVY_JAR%;%IVY_JAR%" groovy.ui.GroovyMain %* :EOF
wget ã³ãã³ã㯠--no-check-certificate ãªãã·ã§ã³ãä»ãã¦å®è¡ãã¦ããã®ã§ãã»ãã¥ã¢ãããããã¾ããããå®è¡ã¯èªå·±è²¬ä»»ã§ã
æºåå®äºï¼
以ä¸ã®2ã¤ã®ãã¡ã¤ã«
- wget.exe
- qroovy.bat
ã PATH ä¸ããã㯠Groovy ã¹ã¯ãªããã¨åããã©ã«ãä¸ã«é ç½®ããã¦ã¾ãããï¼ããããªãæºåå®äºã
ã¹ã¯ãªããã®å®è¡
ãã¦ãã§ã¯ã¹ã¯ãªããã®å®è¡ããhello.groovy ã¨ãã Groovy ã¹ã¯ãªãããå®è¡ããããªã
qroovy hello.groovy
ã¨ããã³ãã³ããå®è¡ãã¾ãï¼æ¡å¼µå .groovy ã¯çç¥å¯ï¼ããã³ãã³ãã¯ãgroovyãã§ã¯ãªããqroovyãããè¨å®ãããã³ã¨ã§ãã¦ããã°ãgroovy-all-2.0.1.jar, ivy-2.2.0.jar ããã¦ã³ãã¼ãããã¦*5 Groovy ã¹ã¯ãªãããå®è¡ãããããºã§ãããã¡ãªã¿ã«ãLeiningen ã§ã¯ãLeiningen èªä½ãã¤ã³ã¹ãã¼ã«ããããã«æåãlein self-installãã¨ãã£ãã³ãã³ããå®è¡ããå¿ è¦ãããã¾ããããä¸è¨ã®ããããã¡ã¤ã«ã§ã¯å¿ è¦ããã¾ããã
ãã¡ããåèå ã® test.gr ãåãã¾ãï¼
set JAVA_OPTS=-Dgroovy.source.encoding=UTF-8 -Dfile.encoding=UTF-8 qroovy test.gr
ã¤ã¾ãã¨ããã@Grab 㧠Java ã©ã¤ãã©ãªããã¦ã³ãã¼ãã§ãã¾ãã¨ã£ã¦ãã¨ã§ãã
è¨å®ã§ããå¤æ°
ä¸è¨ã®ããããã¡ã¤ã«ã«ã¯ãããã¤ãè¨å®ã§ããå¤æ°ãããã¾ãï¼
å¤æ°å | 説æ | ããã©ã«ãå¤ |
---|---|---|
GROOVY_VERSION | 使ç¨ãã Groovy ã®ãã¼ã¸ã§ã³ | 2.0.1 |
IVY_VERSION | 使ç¨ãã Ivy ã®ãã¼ã¸ã§ã³ | 2.2.0 |
QROOVY_REPO | ãã¦ã³ãã¼ããã Jar ãã¡ã¤ã«ã®æ ¼ç´å ´æ | %USERPROFILE%\.qroovy*6 |
JAVA_CMD | 使ç¨ãã Java å®è¡ã³ãã³ã | java |
JVM_OPT(JAVA_OPT) | Java å®è¡ã³ãã³ãã«æ¸¡ããã©ã¡ã¼ã¿ |
ä¾ãã°ãããã©ã«ãã§ã¯ä½¿ç¨ããã Groovy ã®ãã¼ã¸ã§ã³ã¯ 2.0.1 ã§ãããå¥ãã¼ã¸ã§ã³ã® Groovy ã使ãããã¨ãã«ã¯ã³ãã³ãã»ããã³ããä¸ã§
set GROOVY_VERSION=1.8.7 qroovy hello.groovy
ã®ããã«ããã°ãgroovy-all-1.8.7.jar ããã¦ã³ãã¼ãããã¦ããã®ãã¼ã¸ã§ã³ã® Groovy ã§å®è¡ã§ãã¾ãã
ä»å¾ã»ã»ã»
ãã£ã±ããã¸ã¡ã«ããã«ã¯ Cygwin + ã·ã§ã«ã»ã¹ã¯ãªããããã£ãæ¹ãããã®ããªï¼
追è¨
ãã¡ãã§ç´¹ä»ããã¦ãã GVM (Groovy enVironment Manager) ã®æ¹ãããããããï¼ã¨ãããã¨ã§ã
- ä½è : é¢è°·åæ,ä¸å潤äº,é æ±ä¿¡æ´,ä¸ééæ²»
- åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾
- çºå£²æ¥: 2011/07/06
- ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼
- è³¼å ¥: 6人 ã¯ãªãã¯: 392å
- ãã®ååãå«ãããã° (152件) ãè¦ã
*1:å¿ è¦ãª Java ã©ã¤ãã©ãªããã¦ã³ãã¼ãããã©ã¤ãã©ãªã
*2:Clojure çã® Maven çåå¨ã
*3:Windows ã®ããããã¡ã¤ã«ã§ã ftp ã³ãã³ãã¨ãã§ãã¦ã³ãã¼ãã§ããã®ããªï¼
*4:zip ã¢ã¼ã«ã¤ãä¸ã«ã¯ãwget ã®ã¤ã³ã¹ãã¼ã©ããã£ãããããããã§ã¤ã³ã¹ãã¼ã«ãã¦ã大ä¸å¤«ã ã¨æãã¾ãã
*5:ãããã® Jar ãã¡ã¤ã«ã¯ï¼ç¹ã«è¨å®ããªããã°ï¼ãUSERPROFILE\.qroovyããã©ã«ãï¼ãã¶ãã${user.home}/.qroovyãã¨åãï¼ã«ãã¦ã³ãã¼ãããã¾ãã
*6:USERPROFILE ã®å¤ã¯ããã¶ã Java ã§ã® user.home ããããã£ã®å¤ã¨åãã