Can Gradle handle a build directory structure that does not conform default conventions?
문제
I am working on a java ant+ivy based project that has the following directory structure:
projectRoot/src
projectRoot/classes
projectRoot/conf
projectRoot/webservices
this works perfectly well in ant but I am looking to migrate to gradle.
Is there a way to define a non-maven directory structure in Gradle or should I be looking to mavenize?
해결책
It is very easy with Gradle to adapt to any directory structure. See the Working with source sets section of the Gradle User Guide.
다른 팁
Example with non-standard project directory structure (custom layout):
sourceSets {
main {
java {
srcDir 'sources/main/java'
}
outputDir = file("$workDir/client/program")
// For older version (now deprecated):
//output.classesDir = "$workDir/client/program"
}
test {
java {
srcDir 'sources/test/java'
}
outputDir = file("$workDir/client/tests")
// For older versions (now deprecated):
//output.classesDir = "$workDir/client/tests"
//output.resourcesDir = "$workDir/client/tests"
}
resources {
srcDirs 'sources/test/res'
}
}
Try:
sourceSets {
main {
java {
srcDirs = ['src/java']
}
resources {
srcDirs = ['src/resources']
}
}
}
or
sourceSets {
main.java.srcDirs += 'src/java'
main.resources.srcDirs += 'src/resources'
}
제휴하지 않습니다 StackOverflow