public static ScriptCompilerPluginSpec getCompilerSpec ( ) { Path groovyRuntimePath = ClassPathUtils . findRootPathForResource ( "META-INF/groovy-release-info.properties" , Groovy2PluginUtils . class . getClassLoader ( ) ) ; if ( groovyRuntimePath == null ) { throw new IllegalStateException ( "couldn't find groovy-all.n.n.n.jar in the classpath." ) ; } String resourceName = ClassPathUtils . classNameToResourceName ( Groovy2CompilerPlugin . class . getName ( ) ) ; Path nicobarGroovyPluginPath = ClassPathUtils . findRootPathForResource ( resourceName , Groovy2PluginUtils . class . getClassLoader ( ) ) ; if ( nicobarGroovyPluginPath == null ) { throw new IllegalStateException ( "couldn't find nicobar-groovy2 in the classpath." ) ; } // Create the compiler spec ScriptCompilerPluginSpec compilerSpec = new ScriptCompilerPluginSpec . Builder ( Groovy2CompilerPlugin . PLUGIN_ID ) . withPluginClassName ( Groovy2CompilerPlugin . class . getName ( ) ) . addRuntimeResource ( groovyRuntimePath ) . addRuntimeResource ( nicobarGroovyPluginPath ) . build ( ) ; return compilerSpec ; }
Helper method to orchestrate commonly required setup of nicobar - groovy2 and return a groovy2 compiler spec .