1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- apply plugin: 'maven-publish'
- //apply plugin: 'maven'
- Properties properties = new Properties()
- properties.load(project.rootProject.file('local.properties').newDataInputStream())
- publishing {
- repositories {
- maven {
- credentials {
- username properties.getProperty("nexus.user")
- password properties.getProperty("nexus.password")
- }
- url properties.getProperty("POM_URL") // 仓库地址
- // allowInsecureProtocol = true
- }
- }
- }
- afterEvaluate {
- publishing {
- publications {
- release(MavenPublication) {
- // 添加以下配置可以自动从编译容器中获取release版本内容(使用debug可以获取debug版本内容),并生成pom文件
- // 注意:发布物声明必须在 afterEvaluate 内部,因为 components 在 afterEvaluate 阶段才生成完成
- from components.release //可以配置成debug 或者release
- version properties.getProperty("POM_VERSION")//版本
- artifactId properties.getProperty("POM_ATRIFACT_ID")
- groupId properties.getProperty("POM_GROUP_ID")
- // description '版本信息'
- // project {
- // licenses {
- // license {
- // name 'The Apache Software License, Version 2.0'
- // url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- // }
- // }
- // }
- }
- }
- }
- }
- //gradlew uploadArchives terminal中输入
|