gradle配置 uploadArchives上传文件到私服仓库

apply plugin: 'maven'
uploadArchives {
    repositories {
        mavenDeployer {
            pom.artifactId = '项目信息'
            pom.version = '版本信息'
            repository(url: '私服仓库地址') {
                authentication(userName: '账号', password: '密码')
            }
            snapshotRepository(url: '私服快照地址') {
               authentication(userName: '账号', password: '密码')
            }
        }
    }
}

如果配置为xxx.gradle文件,需要在build.gradle里引用
apply from: “${rootDir}/gradle/xxx.gradle”

加上以下内容会将源码上传到私服

task sourceJar (type:Jar) {
    classifier = 'sources'
    from sourceSets.main.allSource
}

artifacts {
    archives sourceJar
}
apply plugin: 'maven'
task sourceJar (type:Jar) {
    classifier = 'sources'
    from sourceSets.main.allSource
}

artifacts {
    archives sourceJar
}
uploadArchives {
    repositories {
        mavenDeployer {
            pom.artifactId = '项目信息'
            pom.version = '版本信息'
            repository(url: '私服仓库地址') {
                authentication(userName: '账号', password: '密码')
            }
            snapshotRepository(url: '私服快照地址') {
               authentication(userName: '账号', password: '密码')
            }
        }
    }
}

你可能感兴趣的:(gradle)