Skip to content

Instantly share code, notes, and snippets.

@kattrali
Created October 27, 2010 18:24
Show Gist options
  • Save kattrali/649634 to your computer and use it in GitHub Desktop.
Save kattrali/649634 to your computer and use it in GitHub Desktop.
A sample configuration file for loading the groovy class path for better syntax checking in redcar (with some grails mixed in). Save as [project]/.redcar/classpath.groovy
// classpath retriever for all jars in project "lib" folder and compiled classes in project,
// plus a hacky way to load ivy dependencies (until I can get groovy Grape configured properly)
//import groovy.grape.Grape
//import groovy.util.ConfigObject
//import groovy.util.ConfigSlurper
def redcar_config = new File(getClass().protectionDomain.codeSource.location.path).parentFile
def project = redcar_config.parentFile
def classpath = []
def home = System.getProperty("user.home")
def cache = new File(home+File.separator+".ivy2"+File.separator+"cache")
//manual ivy resolution; jars must already be installed.
def ivy = { map ->
cache.path + File.separator +
map.group + File.separator +
map.module + File.separator +
"jars" + File.separator +
"${map.module}-${map.version}.jar"
}
classpath << ivy(group:'com.mycompany', module:'interchange', version:'1.0-SNAPSHOT')
classpath << ivy(group:'com.mycompany', module:'project' , version:'3.1-SNAPSHOT')
classpath << ivy(group:'com.mycompany', module:'commons' , version:'3.1-SNAPSHOT')
classpath << ivy(group:'com.mycompany', module:'testutils' , version:'1.0-SNAPSHOT')
//compiled classes
def target_classes = new File(
project.path + File.separator +
"target" + File.separator +
"classes"
)
classpath << target_classes.path
//installed libraries
def lib = new File(project.path + File.separator + "lib")
lib.list().each {name -> classpath << lib.path+File.separator+name}
// grails plugin classes
def plugin_classes = new File(
home + File.separator +
".grails" + File.separator +
"1.3.5" + File.separator + // NOTE: update on grails upgrade
"projects" + File.separator +
"projectname" + File.separator +
"plugin-classes"
)
classpath << plugin_classes.path
return classpath.toArray()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment