On 27/07/10 3:04 PM, Alessandro Marino wrote:
Hello,
I'm trying to write a build script that compiles some classes and put
them togheter with a few resources.
The resources are composed by: all files in the 'images' directory and
a few files in the root directory.
I would like to mantain the same layout also in the resulting jar.
$ cat build.gradle
usePlugin 'java'
version = '4.1.1'
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDirs 'images'
destinationDir file('images')
}
}
}
defaultTasks 'jar'
After executing this script I get:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/gbs00819/schemas/build.gradle' line: 12
* What went wrong:
A problem occurred evaluating root project 'schemaSpy'.
Cause: Could not find method destinationDir() for arguments
[/home/gbs00819/schemas/images] on source set main.
* Try:
Run with -s or -d option to get more details. Run with -S option to
get the full (very verbose) stacktrace.
BUILD FAILED
Total time: 4.16 secs
How can I define to include all file under 'images' preserving the
folder?
The script doesn't address the requirement to include some files in
the project's root directory also in the jar. How can I do that?
There's a couple of options. One is:
sourceSets {
main {
resources {
srcDir projectDir
include 'images/**'
include 'someFileInTheRootDir'
include 'someOtherFileInTheRootDir'
}
}
}
The other is to get rid of the resources { } section, and configure the
processResource task directly:
processResources {
from(projectDir) {
include 'images/**'
include 'someFileInTheRootDir'
}
}
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email