public
Last active

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

  • Download Gist
classpath.groovy
Groovy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
// 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()

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.