On 20/05/2011, at 2:30 AM, Luis Muniz wrote:
> Hi
>
> I'm discovering gradle, and though it is really nice, the learning curve is
> steeper than I thought when you start doing funkier stuff. This is obviously
> because I am uninformed both in the gradle implementatino and in the
> complexity of building engines.
>
> This is my issue
>
> I am trying to factor out common tasks to the parent project, to do this, I
> have defined the tasks in the following way, on the root project:
>
> subprojects {
> apply plugin: 'groovy'
> apply plugin: 'maven'
> apply from: "$rootDir/cobertura.gradle"
> apply from: "$rootDir/idea.gradle"
>
> repositories {
> [...]
> }
>
> configurations {
> [...]
> }
>
> dependencies {
> [...]
> }
>
> [...(etc, etc) ]
>
> uploadArchives {task->
> repositories.mavenDeployer {
> uniqueVersion = true
> name = 'httpDeployer'
> configuration = configurations.deployerJars
> def repoURL = "http://artifactory:8081/artifactory"
> repoURL += version.contains("-SNAPSHOT") ?
> "/libs-snapshots-local" : "/libs-releases-local"
>
> repository(url: repoURL) {
> authentication(userName: "a", password: "b")
> }
> }
> }
>
You can define both a repository and a snapshot repository for a maven deployer:
uploadArchives {
repositories.mavenDeployer {
repository(url: releaseUrl) { ... }
snapshotRepository(url: snapshotUrl) { ... }
}
}
The appropriate repository will be chosen based on the version, when the task
executes.
--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com