I have a Spring-boot 1.4 project in IntelliJ 15 using gradle 2.3 and QueryDSL 4.1.3 that won't build because my entities are not being built into Q classes by Querydsl. I have the following:
buildscript {
ext {
springBootVersion = '1.4.0.BUILD-SNAPSHOT'
querydslVersion = '4.1.3'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven {url "https://plugins.gradle.org/m2/"}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath "gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.7"
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'jacoco'
apply plugin: 'groovy'
apply plugin: "com.ewerk.gradle.plugins.querydsl"
jar {
baseName = 'billing'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
jcenter()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/libs-snapshot" }
maven { url "https://repo.spring.io/libs-snapshot"}
maven {url "https://plugins.gradle.org/m2/"}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-web')
compile "com.querydsl:querydsl-root:$querydslVersion"
compile "com.querydsl:querydsl-jpa:$querydslVersion"
compile "com.querydsl:querydsl-apt:$querydslVersion:jpa"
compile 'org.codehaus.groovy:groovy-all:2.4.1'
compile fileTree(dir: "libs/qbo-sdk-2.5.0", include: "*.jar")
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
testCompile('org.spockframework:spock-spring:1.0-groovy-2.4') {
exclude group: 'org.spockframework', module: 'spock-core'
}
testCompile("junit:junit")
}
sourceSets {
main {
output.resourcesDir = output.classesDir
}
generated {
java {
srcDirs = ['src/main/generated']
}
}
}
querydsl {
library = 'com.mysema.querydsl:querydsl-apt'
querydslDefault = true
}
test {
reports.junitXml.destination = file('build/test-results/folder')
}
jacoco {
toolVersion = "0.7.0.201403182114"
}
jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
}
configurations {
querydslapt
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
idea {
module {
sourceDirs += file('generated/')
generatedSourceDirs += file('generated/')
}
}
when I run my unit tests I get the error:
Caused by: java.lang.ClassNotFoundException: com.company.billing.customer.QCustomer
And when I run "gradle clean build" I get: Could not find com.mysema.querydsl:querydsl-apt:.
Searched in the following locations: https://repo1.maven.org/maven2/com/mysema/querydsl/querydsl-apt//querydsl-apt-.pom https://repo1.maven.org/maven2/com/mysema/querydsl/querydsl-apt//querydsl-apt-.jar https://jcenter.bintray.com/com/mysema/querydsl/querydsl-apt//querydsl-apt-.pom https://jcenter.bintray.com/com/mysema/querydsl/querydsl-apt//querydsl-apt-.jar https://repo.spring.io/snapshot/com/mysema/querydsl/querydsl-apt//querydsl-apt-.pom https://repo.spring.io/snapshot/com/mysema/querydsl/querydsl-apt//querydsl-apt-.jar https://repo.spring.io/milestone/com/mysema/querydsl/querydsl-apt//querydsl-apt-.pom https://repo.spring.io/milestone/com/mysema/querydsl/querydsl-apt//querydsl-apt-.jar https://repo.spring.io/libs-snapshot/com/mysema/querydsl/querydsl-apt//querydsl-apt-.pom https://repo.spring.io/libs-snapshot/com/mysema/querydsl/querydsl-apt//querydsl-apt-.jar
I realize that QueryDsl did some package refactoring between 3 & 4, but it looks like my dependencies are unable to be found even though they are clearly here: https://mvnrepository.com/artifact/com.querydsl/querydsl-jpa/4.1.3
At least, that is my current theory on why my build fails. Has anyone gotten the latest spring, gradle, and querydsl to work?
Update: I removed the ewerk plugin and simplified my build.gradle file so everything builds properly now. I am updating to help anyone else who might need this:
buildscript {
ext {
springBootVersion = '1.4.0.BUILD-SNAPSHOT'
querydslVersion = '4.1.3'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'jacoco'
apply plugin: 'groovy'
jar {
baseName = 'billing'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
jcenter()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/libs-snapshot" }
maven { url "https://repo.spring.io/libs-snapshot"}
maven {url "https://plugins.gradle.org/m2/"}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-web')
compile "com.querydsl:querydsl-root:$querydslVersion"
compile "com.querydsl:querydsl-jpa:$querydslVersion"
compile "com.querydsl:querydsl-apt:$querydslVersion:jpa"
compile 'org.codehaus.groovy:groovy-all:2.4.1'
compile fileTree(dir: "libs/qbo-sdk-2.5.0", include: "*.jar")
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
testCompile('org.spockframework:spock-spring:1.0-groovy-2.4') {
exclude group: 'org.spockframework', module: 'spock-core'
}
testCompile("junit:junit")
}
test {
reports.junitXml.destination = file('build/test-results/folder')
}
jacoco {
toolVersion = "0.7.0.201403182114"
}
jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
idea {
module {
sourceDirs += file('generated/')
generatedSourceDirs += file('generated/')
}
}