Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def userHome = new File(System.properties.'user.home' as String)
- def localReleaseRepoFile = new File(userHome, 'local-gradle-repository/release')
- def localSnapshotRepoFile = new File(userHome, 'local-gradle-repository/snapshot')
- def localReleaseRepo = localReleaseRepoFile.toURI().toURL().toString()
- def localSnapshotRepo = localSnapshotRepoFile.toURI().toURL().toString()
- ext {
- localReleaseRepoFile = new File(userHome, 'local-gradle-repository/release')
- localSnapshotRepoFile = new File(userHome, 'local-gradle-repository/snapshot')
- localReleaseRepo = localReleaseRepoFile.toURI().toURL().toString()
- localSnapshotRepo = localSnapshotRepoFile.toURI().toURL().toString()
- }
- initscript {
- repositories {
- mavenLocal()
- jcenter()
- mavenCentral()
- }
- dependencies {
- // needed for syncSnapshot and syncStaging
- classpath 'org.apache.maven.wagon:wagon-webdav-jackrabbit:2.10'
- classpath 'commons-codec:commons-codec:1.10'
- }
- }
- rootProject {
- task(group: 'Repository', description: 'Sync local staging-repository to oss.sonatype.org.', 'syncCompanyStaging') << {
- def stagingRepos = new org.apache.maven.wagon.repository.Repository('staging', 'http://[nexus]/content/repositories/releases')
- def auth = new org.apache.maven.wagon.authentication.AuthenticationInfo()
- auth.userName = nexusUserName
- auth.password = nexusPassword
- def wagon = new org.apache.maven.wagon.providers.webdav.WebDavWagon()
- wagon.connect(stagingRepos, auth)
- localReleaseRepoFile.eachFile {
- if (it.directory) {
- wagon.putDirectory(it, it.name)
- } else {
- wagon.put(it, it.name)
- }
- }
- }
- task(group: 'Repository', description: 'Sync local SNAPSHOT-repository to oss.sonatype.org.', 'syncCompanySnapshot') << {
- def snapshotRepos = new org.apache.maven.wagon.repository.Repository('snapshot', 'http://[nexus]/content/repositories/snapshots')
- def auth = new org.apache.maven.wagon.authentication.AuthenticationInfo()
- auth.userName = nexusUserName
- auth.password = nexusPassword
- def wagon = new org.apache.maven.wagon.providers.webdav.WebDavWagon()
- wagon.connect(snapshotRepos, auth)
- localSnapshotRepoFile.eachFile {
- if (it.directory) {
- wagon.putDirectory(it, it.name)
- } else {
- wagon.put(it, it.name)
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement