apply plugin: 'java'
//START SNIPPET upload-file
apply plugin: 'maven'

//START SNIPPET builder
//START SNIPPET customize-pom
//START SNIPPET multiple-poms
uploadArchives {
    repositories.mavenDeployer {
        repository(url: "file://localhost/tmp/myRepo/")
//END SNIPPET upload-file
//END SNIPPET multiple-poms
//END SNIPPET builder
        pom.version = '1.0Maven'
        pom.artifactId = 'myMavenName'
//END SNIPPET customize-pom
//START SNIPPET builder
        pom.project {
            licenses {
                license {
                    name 'The Apache Software License, Version 2.0'
                    url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    distribution 'repo'
                }
            }
        }
//END SNIPPET builder
//START SNIPPET multiple-poms
        addFilter('api') {artifact, file ->
            artifact.name == 'api'
        }
        addFilter('service') {artifact, file ->
            artifact.name == 'service'
        }
        pom('api').version = 'mySpecialMavenVersion'
//START SNIPPET customize-pom
//START SNIPPET upload-file
//START SNIPPET builder
    }
}
//END SNIPPET customize-pom
//END SNIPPET multiple-poms
//END SNIPPET upload-file
//END SNIPPET builder

//START SNIPPET upload-with-ssh
configurations {
    deployerJars
}

repositories {
    mavenCentral()
}

dependencies {
    deployerJars "org.apache.maven.wagon:wagon-ssh:1.0-beta-2"
}

uploadArchives {
    repositories.mavenDeployer {
        name = 'sshDeployer' // optional
        configuration = configurations.deployerJars
        repository(url: "scp://repos.mycompany.com/releases") {
            authentication(userName: "me", password: "myPassword")
        }
    }
}
//END SNIPPET upload-with-ssh

//START SNIPPET customize-installer
configure(install.repositories.mavenInstaller) {
    pom.project {
        version '1.0Maven'
        artifactId 'myName'
    }
}
//END SNIPPET customize-installer

//START SNIPPET mappings
task mappings << {
    println conf2ScopeMappings.mappings
}
//END SNIPPET mappings