Skip to content

Instantly share code, notes, and snippets.

@zvozin
Last active November 11, 2021 14:20
Show Gist options
  • Save zvozin/f46cc9fe1dd00bb648808317e77bf8ca to your computer and use it in GitHub Desktop.
Save zvozin/f46cc9fe1dd00bb648808317e77bf8ca to your computer and use it in GitHub Desktop.
Relevant parts of build.gradle required to get QueryDSL going over Hibernate with Kotlin and IDEA
buildscript {
ext.kotlin_version = '1.1.3-2'
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath("org.jetbrains.kotlin:kotlin-allopen:$kotlin_version")
classpath("org.jetbrains.kotlin:kotlin-noarg:$kotlin_version")
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'kotlin'
apply plugin: "kotlin-jpa"
apply plugin: 'kotlin-kapt'
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
}
}
repositories {
jcenter()
}
idea {
module {
def kaptMain = file('build/generated/source/kapt/main')
sourceDirs += kaptMain
generatedSourceDirs += kaptMain
}
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile("org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}")
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.1.8.Final'
compile "com.mysema.querydsl:querydsl-jpa:3.7.4"
kapt "com.mysema.querydsl:querydsl-apt:3.7.4:jpa" // Magic happens here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment