On 29/07/10 3:46 PM, Andrew Pietsch wrote:
Hi all,

I've defined my maven repository username, password etc in my ~/.gradle/gradle.properties and all is fine on my machine, but I have to comment it out before checking in as the build will fail on other machines.

I've tried using hasProperty('MAVEN_REPOSITORY_USERNAME') as per the following but it the upload archives task doesn't work on my machine.

  if (hasProperty('MAVEN_REPOSITORY_URL')) {
    uploadArchives {
      repositories.mavenDeployer {
        name = 'ftpDeployer'
        // use the configuration we created earlier...
        configuration = configurations.mavenDeployerJars

        repository(url: MAVEN_REPOSITORY_URL) {
authentication(userName: MAVEN_USERNAME, password: MAVEN_PASSWORD)
        }

        snapshotRepository(url: MAVEN_SNAPSHOT_URL) {
authentication(userName: MAVEN_USERNAME, password: MAVEN_PASSWORD)
        }
      }
    }

Is this the correct approach or is there a better way?

This is a reasonable approach for now, though we do want to make this all work better in the future.

How is it not working exactly? You might need to use project.hasProperty('...') instead of hasProperty('...') depending on where the above code is located. For example, a task also has a hasProperty() method, so if the code is inside a task action closure, it will be calling task.hasProperty() instead of project.hasProperty().


--
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


Reply via email to