I am evaluating Gradle on a small project, I need to create an archive containing a number of files and directories from the project (could be jar or zip), as the project cannot be included in the corporate subversion repository.
The required content would be (for now) the ‘src’ and ‘.hg’ directories, as well as the ‘build.gradle’ file. Leaving the single file for later, this:
task sourceDist(type: Jar) {
archiveName = "project-src.jar"
from([fileTree(‘src’), fileTree(’.hg’)])
}
will include the contents of both directories but not the parent directory themselves, so that the contents of both are all mixed up. Specifying “from” a second time will only include the second directory; “into” works but only for a single directory; I tried using the “zip” task instead of “jar” but then no archive is created (and no error message). Any suggestions?