Using querydsl-apt dependency along with jpa classifier I’m able to generate needed code (.java files) under “build/classes/main” directory, where it sits along with compiled code (.class files). I would like to change directory of generated code to something like “src/generated/java” and then add that location to the Java source directory, so that it includes both locations: “src/main/java” and “src/generated/java”. I guess the latter I can achieve with following:
sourceSets {
main {
java {
srcDirs 'src/main/java'
srcDirs 'src/generated/java'
}
}
but I don’t know how to change the output location first.
Here’s my build script:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.6.RELEASE")
}
}
// Apply the java plugin to add support for Java
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
jar {
baseName = 'gs-serving-web-content'
version = '0.1.0'
}
// In this section you declare where to find the dependencies of your project
repositories {
// Use 'jcenter' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
// In this section you declare the dependencies for your production and test code
dependencies {
// The production code uses the SLF4J logging API at compile time
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'org.springframework.boot:spring-boot-starter-web:1.3.6.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-thymeleaf:1.3.6.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-data-jpa:1.3.6.RELEASE'
compile 'mysql:mysql-connector-java:6.0.3'
compile 'com.querydsl:querydsl-jpa:4.1.3'
compile 'com.querydsl:querydsl-apt:4.1.3:jpa'
// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
// 'test.useTestNG()' to your build script.
testCompile 'junit:junit:4.12'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}