On 26/09/2011, at 7:45 PM, blackwolf wrote:
> My gradle.build file is really simple:
>
> apply from: "${System.getenv().GRADLE_COMMON}/plugins/common.gradle"
>
> dependencies {
> compile group: 'commons-logging', name: 'commons-logging', version: '1.1'
> compile group: 'log4j', name: 'log4j', version: '1.2.14'
>
> testCompile group: 'junit', name: 'junit', version: '4.4'
> testCompile group: 'org.easymock', name: 'easymock', version: '2.3'
> testCompile group: 'org.easymock', name: 'easymockclassextension',
> version: '2.3'
> }
>
> artifactoryPublish {
> dependsOn test
> publishConfigs("archives")
> }
>
> and common.gradle is:
>
> apply plugin: 'java'
> apply plugin: 'maven'
> apply plugin: 'artifactory'
>
> // Define some useful paths and set buildDir
> USEFUL_PATH_1 = "foo"
> USEFUL_PATH_2 = "bar"
> buildDir = "/var/tmp/${System.getenv().USER}/build/" + PROJECT_SPECIFIC_PATH
>
> // Define the source sets.
> sourceSets {
> main {
> java {
> srcDirs 'main/java'
> }
> resources {
> srcDirs 'main/resources'
> }
> }
> test {
> java {
> srcDirs 'test/java'
> }
> resources {
> srcDirs 'test/resources'
> }
> }
> }
>
> // Use our Artifactory virtual repository to resolve all dependencies.
> repositories {
> mavenRepo urls: ARTIFACTORY_URL
> }
>
> // Turn on deprecation and unchecked warnings.
> compileJava {
> options.compilerArgs.add '-Xlint:deprecation'
> options.compilerArgs.add '-Xlint:unchecked'
> }
>
> compileTestJava {
> options.compilerArgs.add '-Xlint:deprecation'
> options.compilerArgs.add '-Xlint:unchecked'
> }
>
> // Fix the clean task.
> deleteDirClosure = {
> it.eachDir(deleteDirClosure)
> it.eachFile {
> it.delete()
> }
> }
>
> clean {
> if (buildDir.exists()) {
> deleteDirClosure(buildDir)
> }
> }
>
> // Configuration for uploading build artifacts to Artifactory.
> artifactory {
> // Some Artifactory-specific stuff.
> }
The problem is your clean task. You are performing the clean during
configuration phase, not execution.
someTask {
// I get executed every time, while the build model is being configured
}
someTask << {
// I get executed _only_ when the task is executed
}
Your artifactoryPublish task might have the same problem.
--
Luke Daley
Principal Engineer, Gradleware
http://gradleware.com
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email