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
def GRAILS_VERSION = '1.3.7'
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")
// grails plugin classes
def plugin_classes = new File(
home + File.separator +
".grails" + File.separator +
GRAILS_VERSION + File.separator + // NOTE: update on grails upgrade
"projects" + File.separator +
project.name + File.separator +
"plugin-classes")
classpath << plugin_classes.path
//installed libraries
def lib = new File(project.path + File.separator + "lib")
lib.list().each {name -> classpath << lib.path+File.separator+name}
//compiled classes
def target_classes = new File(
project.path + File.separator +
"target" + File.separator +
"classes"
)
classpath << target_classes.path
/* manual ivy resolution */
//fake ivy dependency loader
def ivy = { map ->
cache.path + File.separator +
map.group + File.separator +
map.module + File.separator +
"jars" + File.separator +
"${map.module}-${map.version}.jar"
}
//grails version dependencies
[
'grails-bootstrap','grails-core','grails-crud','grails-gorm','grails-spring',
'grails-test','grails-web'
].each { module ->
classpath << ivy(group:'org.grails',module:module,version: GRAILS_VERSION)
}
//spring framework dependencies
[
'org.springframework.beans','org.springframework.context','org.springframework.core',
'org.springframework.jms', 'org.springframework.test','org.springframework.web',
'org.springframework.web.servlet','spring-tx'
].each { module ->
classpath << ivy(group:'org.springframework',module: module,version:'3.0.3.RELEASE')
}
classpath << ivy(group:'commons-lang' ,module: 'commons-lang' ,version: '2.4' )
classpath << ivy(group:'commons-logging' ,module: 'commons-logging',version: '1.1.1' )
classpath << ivy(group:'javax.servlet' ,module: 'jsp-api' ,version: '1.2' )
classpath << ivy(group:'org.apache.ant' ,module: 'ant-junit' ,version: '1.7.1' )
classpath << ivy(group:'org.hibernate' ,module: 'hibernate-core' ,version: '3.3.1.GA' )
classpath << ivy(group:'org.jscience' ,module: 'jscience' ,version: '4.3' )
classpath << ivy(group:'junit' ,module: 'junit' ,version: '4.8.1' )
return classpath.toArray()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment