Skip to content

Instantly share code, notes, and snippets.

@otwm
Created January 1, 2016 18:17
Show Gist options
  • Save otwm/3e874646410248db41b9 to your computer and use it in GitHub Desktop.
Save otwm/3e874646410248db41b9 to your computer and use it in GitHub Desktop.
queryDsl generate by gradle
apply plugin: 'spring-boot'
jar {
baseName = 'core'
version = '0.5.0'
}
sourceSets {
generated {
java {
srcDirs = ['src/main/generated']
}
}
}
configurations {
provided
}
dependencyManagement {
imports {
mavenBom 'org.springframework.data:spring-data-releasetrain:Gosling-SR1'
}
}
dependencies {
def querydslVersion = '3.7.0'
compile("org.springframework.boot:spring-boot-starter-data-rest")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile('com.mysema.querydsl:querydsl-jpa:3.7.0')
compile('com.mysema.querydsl:querydsl-apt:3.7.0')
provided "com.mysema.querydsl:querydsl-apt:3.7.0"
testCompile("com.h2database:h2")
compile('com.oracle:ojdbc14:10.2.0.4.0')
}
task generateQueryDSL(type: JavaCompile, group: 'build', description: 'Generates the QueryDSL query types') {
source = sourceSets.main.java
classpath = configurations.compile + configurations.provided
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')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment