Grails 1.3.5는 Groovy 1.7.5를 사용하고 있습니다. Groovy 버전에서 GroovyScriptEngine.run(..)
은 createScript(String, Binding)
->loadScriptByName(String)
->isSourceNewer(ScriptCacheEntry)
의 메소드를 호출합니다.
isSourceNewer(ScriptCacheEntry)
은 (불행하게도, 내가 웹에 일치하는 소스 파일을 찾을 수 없습니다)으로 정의된다 :
제 (동성애) 로직을 구현
protected boolean isSourceNewer(ScriptCacheEntry entry)
throws ResourceException {
// ...
for (String scriptName : entry.dependencies) {
// ...
return true; // without any further condition!
}
return false;
}
스크립트 종속성이있는 경우 "는보다 새로운 캐시 된 스크립트 (및 다시 컴파일해야 함) ". 이것은 코드가해야하는 것이 아닙니다. 수정 시간으로 결정해야합니다.
newer versions of GroovyScriptEngine
, this has been corrected (로직이 크게 변경되었습니다.)하지만 지금은 로직을 직접 수정하려면 GroovyScriptEngine
을 서브 클래스 화하고 isSourceNewer(ScriptCacheEntry)
을 덮어 써야합니다.
편집 : 버그는 그루비 1.7.6에 reported 및 fixed을하고있다. Grails lib 폴더에서 Groovy 1.7.6을 사용해보십시오.
확실하지 그것을 설정했지만, 문제는 Groovy 스크립트 번호 isSourceNewer는 ScriptCacheEntry 객체를 사용합니다. 이름에서 알 수 있듯이 캐시 (지도)에서 가져옵니다. GroovyScriptEngine이 생성되면이 맵은 비어 있습니다. 항목이 없다는 것은 isSourceNewer가 true를 반환하고 컴파일을 트리거 함을 의미합니다. – IttayD