at the moment i'm running in mixed default mode - so i have both java and groovy in same src/main/java file and i'm trying to use joint compilation
i then set the extra source setlike this
//define where the generated output classes will go for queryDSL
sourceSets {
generated {
java {
srcDirs = ['src/main/generated']
}
}
}
I set a new top level attribute : generatedDir as this
ext {
//spring_version = "3.1.4.RELEASE"
spring_data_version = "1.3.2.RELEASE"
//added new line
generatedDir = sourceSets.generated.java.srcDirs.iterator().next()
}
I then define my task like this - this time extending GroovyCompile as my domain class is groovy class - if i try and print sourceSets.main.java - it only gets me the QueryDslPredicateExecutor java file (the only java file i have) - which is wrong so i force the source to be my Order.groovy file (annotated with @Document and @QueryEntity. I set the annotation processor (seems to make no difference) and set the -s outputdirectory for the source to go to. GroovyCompile type forces you to set the destinationDir so i set it as my generated dir again
task generateQueryDSL(type: GroovyCompile,
group: 'build',
description: 'Generates the QueryDSL query types') {
//source = sourceSets.main.java /*-wrong only one file found sourceSets.main.java */
println ">> running the generateQueryDSL with generatedDir = $generatedDir"
source = "C:/Users/802518659/Documents/temp (not backed up)/grails 3.3 workspace/MongoSpringData/src/main/java/com/softwood/Order.groovy"
println ">> running the generateQueryDSL on ${source.getAsPath()}"
classpath = configurations.compile + configurations.querydslapt
//for groovy compiler as list
// very pinetickey - if theres a space in the javac between the directive and value, needs to be as
// two list items
options.compilerArgs = [ "-proc:only", // process annotations only in pass
//"-processor", "com.mysema.query.apt.QuerydslAnnotationProcessor", //processor to use
"-processor", "org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor", //processor to use
/*"com.mysema.query.apt.QuerydslAnnotationProcessor"*/ /*"org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor" , */
"-s", "$generatedDir" //output directory where generated
]
destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
def lopt = options.compilerArgs
println ">> compiler options " + lopt
println ">> with destination as " + destinationDir
}
output with --info on is as follows - but no generated QOrder.java (or groovy is generated) - not sure where next any ideas
The client will now receive all logging from the daemon (pid: 5324). The daemon log file: C:\Users\802518659\.gradle\daemon\1.5\daemon-5324.out.log
Executing build with daemon context: DefaultDaemonContext[uid=a450b9a0-013e-4f59-aebc-ea0bd9e16fba,javaHome=C:\Program Files (x86)\Java\jdk1.7.0_21,daemonRegistryDir=C:\Users\802518659\.gradle\daemon,pid=5324,idleTimeout=10800000,daemonOpts=-Xms128m,-Xmx256m,-Dfile.encoding=windows-1252]
Closing daemon's stdin at end of input.
The daemon will no longer process any standard input.
Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using build file 'C:\Users\802518659\Documents\temp (not backed up)\grails 3.3 workspace\MongoSpringData\build.gradle'.
Included projects: [root project 'MongoSpringData']
Evaluating root project 'MongoSpringData' using build file 'C:\Users\802518659\Documents\temp (not backed up)\grails 3.3 workspace\MongoSpringData\build.gradle'.
>> running the generateQueryDSL with generatedDir = C:\Users\802518659\Documents\temp (not backed up)\grails 3.3 workspace\MongoSpringData\src\main\generated
>> running the generateQueryDSL on C:\Users\802518659\Documents\temp (not backed up)\grails 3.3 workspace\MongoSpringData\src\main\java\com\softwood\Order.groovy
>> compiler options [-proc:only, -processor, org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor, -s, C:\Users\802518659\Documents\temp (not backed up)\grails 3.3 workspace\MongoSpringData\src\main\generated]
>> with destination as C:\Users\802518659\Documents\temp (not backed up)\grails 3.3 workspace\MongoSpringData\src\main\generated
All projects evaluated.
:: loading settings :: url = jar:file:/C:/Users/802518659/.gradle/wrapper/dists/gradle-1.5-bin/9si5v6u7tk37kj5dlsrdcm595/gradle-1.5/lib/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
Selected primary tasks ':build', ':compileGeneratedJava', ':compileGroovy', ':compileJava', ':compileGeneratedGroovy', ':eclipseClasspath', ':generateQueryDSL', ':generatedClasses', ':processGeneratedResources', ':processResources'
Tasks to be executed: [task ':generateQueryDSL', task ':compileJava', task ':compileGroovy', task ':processResources', task ':classes', task ':jar', task ':assemble', task ':compileTestJava', task ':compileTestGroovy', task ':processTestResources', task ':testClasses', task ':test', task ':check', task ':build', task ':compileGeneratedJava', task ':compileGeneratedGroovy', task ':eclipseClasspath', task ':processGeneratedResources', task ':generatedClasses']
:generateQueryDSL
Skipping task ':generateQueryDSL' as it is up-to-date.
Skipping task ':generateQueryDSL' as it is up-to-date
:generateQueryDSL UP-TO-DATE
:compileJava
Skipping task ':compileJava' as it is up-to-date.
Skipping task ':compileJava' as it is up-to-date
:compileJava UP-TO-DATE
:compileGroovy
Skipping task ':compileGroovy' as it has no source files.
:compileGroovy UP-TO-DATE
:processResources
Skipping task ':processResources' as it is up-to-date.
Skipping task ':processResources' as it is up-to-date
:processResources UP-TO-DATE
:classes
Skipping task ':classes' as it has no actions.
:classes UP-TO-DATE
:jar
Skipping task ':jar' as it is up-to-date.
Skipping task ':jar' as it is up-to-date
:jar UP-TO-DATE
:assemble
Skipping task ':assemble' as it has no actions.
:assemble UP-TO-DATE
:compileTestJava
Skipping task ':compileTestJava' as it has no source files.
:compileTestJava UP-TO-DATE
:compileTestGroovy
Skipping task ':compileTestGroovy' as it has no source files.
:compileTestGroovy UP-TO-DATE
:processTestResources
Skipping task ':processTestResources' as it is up-to-date.
Skipping task ':processTestResources' as it is up-to-date
:processTestResources UP-TO-DATE
:testClasses
Skipping task ':testClasses' as it has no actions.
:testClasses UP-TO-DATE
:test
file or directory 'C:\Users\802518659\Documents\temp (not backed up)\grails 3.3 workspace\MongoSpringData\build\classes\test', not found
Skipping task ':test' as it is up-to-date.
Skipping task ':test' as it is up-to-date
:test UP-TO-DATE
:check
Skipping task ':check' as it has no actions.
:check UP-TO-DATE
:build
Skipping task ':build' as it has no actions.
:build UP-TO-DATE
:compileGeneratedJava
Skipping task ':compileGeneratedJava' as it has no source files.
:compileGeneratedJava UP-TO-DATE
:compileGeneratedGroovy
Skipping task ':compileGeneratedGroovy' as it has no source files.
:compileGeneratedGroovy UP-TO-DATE
:eclipseClasspath
:processGeneratedResources
Skipping task ':processGeneratedResources' as it has no source files.
:processGeneratedResources UP-TO-DATE
:generatedClasses
Skipping task ':generatedClasses' as it has no actions.
:generatedClasses UP-TO-DATE
On Saturday, November 9, 2013 4:22:49 PM UTC, William Woodman wrote: