Created
April 13, 2013 06:59
-
-
Save edwardbeckett/5377401 to your computer and use it in GitHub Desktop.
mysema.querydsl gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sourceSets { | |
generated { | |
java { | |
srcDirs = ['src/main/generated'] | |
} | |
} | |
} | |
configurations { | |
querydslapt | |
} | |
dependencies { | |
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final' | |
compile "com.mysema.querydsl:querydsl-jpa:$querydslVersion" | |
querydslapt "com.mysema.querydsl:querydsl-apt:$querydslVersion" | |
} | |
task generateQueryDSL(type: JavaCompile, group: 'build', description: 'Generates the QueryDSL query types') { | |
source = sourceSets.main.java | |
classpath = configurations.compile + configurations.querydslapt | |
options.compilerArgs = [ | |
"-proc:only", | |
"-processor", "com.mysema.query.apt.jpa.JPAAnnotationProcessor" | |
] | |
destinationDir = sourceSets.generated.java.srcDirs.iterator().next() | |
} | |
compileJava { | |
dependsOn generateQueryDSL | |
source generateQueryDSL.destinationDir | |
} | |
compileGeneratedJava { | |
dependsOn generateQueryDSL | |
options.warnings = false | |
classpath += sourceSets.main.runtimeClasspath | |
} | |
clean { | |
delete sourceSets.generated.java.srcDirs | |
} | |
idea { | |
module { | |
sourceDirs += file('src/main/generated') | |
} | |
} |
How can I configure this for groovy based project?
I tried changing as following but MetaModels are not being generated for Entity class but empty directory structure is created.
task generateQueryDSL(type: GroovyCompile, group: 'build', description: 'Generates the QueryDSL query types') {
source = sourceSets.main.groovy
classpath = configurations.compile + configurations.querydslapt
options.compilerArgs = [
"-proc:only",
"-processor", "com.mysema.query.apt.jpa.JPAAnnotationProcessor"
]
destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
}```
It would be too different to configure the task generateQueryDSL for MongoDB?
thx a lot!! very useful infomation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to use querydsl with my spring-boot project. However, I cannot find a working example of using gradle with querydsl. Looking at this gist, I thought it would work. However, the line " querydslapt" is causing Gradle to fail:
Could not find method querydslapt() for arguments [com.mysema.querydsl:querydsl-apt:3.3.2]
I tried changing back to an earlier version, but that failed also:
Could not find method querydslapt() for arguments [com.mysema.querydsl:querydsl-apt:2.8.1]
The line that fails is this:
querydslapt "com.mysema.querydsl:querydsl-apt:2.8.1"
Can you tell me if this script does in fact work, and if so what does querydslapt() do?