Properly set defaults for gradle properties

gradle, groovy, properties

Solution

Looks like it is because `repoUrl=file://$buildDir/repo` is treated as plain string, without `buildDir` substitution.

If may try this:

`repository(url: repoUrl.replace('$buildDir', "$buildDir")) {`

Or something like this:

// run as 'gradle build -PreportUrl=blabla'
def repoUrl = "file://$buildDir/repo"
if (binding.variables.containsKey('repoUrl ')) {
 repoUrl = binding.variables.get('repoUrl ')
}

Problem

Having the following in `build.gradle`: ``` uploadArchives { repositories { mavenDeployer { repository(url: "$repoUrl") { authentication(userName: "$repoUser", password: "$repoPassword") } } } } ``` how can I make `$repoUrl` have a default value `file://$buildDir/repo`? I tried to put `repoUrl=file://$buildDir/repo` in `gradle.properties`, but it doesn't work as I expected, as it seems that `$repoUrl` is not evaluated recursively.

Original source