我希望通过gradle将querydsl带入我的spring-boot项目.尽管在网上找到了几个例子,但由于依赖性问题(我认为),它们实际上都不适合我.根据QueryDSL支持论坛,尚不支持gradle.但是我想知道如果有人设法让它工作了所有的gradle和spring-boot?
这是我的build.gradle:
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'jacoco'
apply plugin: 'war'
buildscript {
repositories {
maven { url "http://repo.spring.io/libs-snapshot" }
mavenLocal()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.0.RC4")
}
}
repositories {
mavenCentral()
maven { url: "http://repo.spring.io/libs-snapshot" }
// maven { url: "http://repo.spring.io/milestone" }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web:1.0.0.RC5")
compile("org.springframework.boot:spring-boot-starter-data-jpa:1.0.0.RC5")
compile("org.springframework:spring-orm:4.0.0.RC1")
compile("org.hibernate:hibernate-entitymanager:4.2.1.Final")
compile("com.h2database:h2:1.3.172")
compile("joda-time:joda-time:2.3")
compile("org.thymeleaf:thymeleaf-spring4")
compile("org.codehaus.groovy.modules.http-builder:http-builder:0.7.1")
compile('org.codehaus.groovy:groovy-all:2.2.1')
compile('org.jadira.usertype:usertype.jodatime:2.0.1')
// this line fails
querydslapt "com.mysema.querydsl:querydsl-apt:3.3.2"
testCompile('org.spockframework:spock-core:0.7-groovy-2.0') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
testCompile('org.codehaus.groovy.modules.http-builder:http-builder:0.7+')
testCompile("junit:junit")
} …Run Code Online (Sandbox Code Playgroud) 我使用gradle 2.3和QueryDSL 4.1.3在IntelliJ 15中有一个Spring-boot 1.4项目,因为我的实体没有被Querydsl构建到Q类中.我有以下内容:
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() …Run Code Online (Sandbox Code Playgroud)