이것은 실행 파일 groovyc
을 실행하는 래퍼 배치 스크립트로 인해 발생합니다. 내가 배치 파일에 전문가는 아니지만 그러나 당신이 startGroovy.bat
을 자세히 보면 쉽게이 있음을 알 수 있습니다
"%DIRNAME%\startGroovy.bat" "%DIRNAME%" org.codehaus.groovy.tools.FileSystemCompiler %*
:
Windows에서
의 groovyc
명령은 startGroovy.bat
라는 배치 스크립트를 시작합니다 스크립트에 인수로 전달되는 *
와일드 카드에서 수행되고있는 해킹의 어떤 종류 (예 : c:\scripts\*.groovy
) :
rem escape minus (-d), quotes (-q), star (-s).
set _ARGS=%*
if not defined _ARGS goto execute
set _ARGS=%_ARGS:-=-d%
set _ARGS=%_ARGS:"=-q%
rem Windowz will try to match * with files so we escape it here
rem but it is also a meta char for env var string substitution
rem so it can't be first char here, hack just for common cases.
rem If in doubt use a space or bracket before * if using -e.
set _ARGS=%_ARGS: *= -s%
set _ARGS=%_ARGS:)*=)-s%
set _ARGS=%_ARGS:0*=0-s%
set _ARGS=%_ARGS:1*=1-s%
set _ARGS=%_ARGS:2*=2-s%
set _ARGS=%_ARGS:3*=3-s%
set _ARGS=%_ARGS:4*=4-s%
set _ARGS=%_ARGS:5*=5-s%
set _ARGS=%_ARGS:6*=6-s%
set _ARGS=%_ARGS:7*=7-s%
set _ARGS=%_ARGS:8*=8-s%
set _ARGS=%_ARGS:9*=9-s%
당신은 executin에 의해 반향을 켜면 g set DEBUG=on
을 입력 한 다음 groovyc
명령을 다시 실행하면 일괄 처리 스크립트의 출력을 얻을 수 있으며 여기서 와일드 카드가 처리되는 방식을 볼 수 있습니다. 다음은 예제 로그이며 File1.groovy
, File2.groovy
및 File3.groovy
의 세 파일이있는 시나리오입니다.
groovyc -d c:\destPath c:\scripts\*.groovy
샘플 출력 :
C:\scripts>set _ARG=C:\scripts\File3.groovy
C:\scripts>set _ARG=C:\scripts\File3.groovy
C:\scripts>set _ARG=C:\scripts\File3.groovy
C:\scripts>set CMD_LINE_ARGS= C:\scripts\File3.groovy
C:\scripts>set _ARG=
는 스크립트가 처음 두 파일을 무시하고 결국 마지막 하나는 org.codehaus.groovy.tools.FileSystemCompiler
클래스 (실제 컴파일러)에 전달되는 것 같다. *
와일드 카드가 원본 파일 경로의 첫 번째 문자 인 경우이 동작이 존재하지 않습니다.
내 우분투 상자에서는'-d' 매개 변수가 마지막에 오거나 스크립트가 컴파일되지 않으면 작동합니다. – Will
재미 있습니다. –