bintrayUpload.gradle 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. apply plugin: 'maven-publish'
  2. //apply plugin: 'maven'
  3. Properties properties = new Properties()
  4. properties.load(project.rootProject.file('local.properties').newDataInputStream())
  5. publishing {
  6. repositories {
  7. maven {
  8. credentials {
  9. username properties.getProperty("nexus.user")
  10. password properties.getProperty("nexus.password")
  11. }
  12. url properties.getProperty("POM_URL") // 仓库地址
  13. // allowInsecureProtocol = true
  14. }
  15. }
  16. }
  17. afterEvaluate {
  18. publishing {
  19. publications {
  20. release(MavenPublication) {
  21. // 添加以下配置可以自动从编译容器中获取release版本内容(使用debug可以获取debug版本内容),并生成pom文件
  22. // 注意:发布物声明必须在 afterEvaluate 内部,因为 components 在 afterEvaluate 阶段才生成完成
  23. from components.release //可以配置成debug 或者release
  24. version properties.getProperty("POM_VERSION")//版本
  25. artifactId properties.getProperty("POM_ATRIFACT_ID")
  26. groupId properties.getProperty("POM_GROUP_ID")
  27. // description '版本信息'
  28. // project {
  29. // licenses {
  30. // license {
  31. // name 'The Apache Software License, Version 2.0'
  32. // url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  33. // }
  34. // }
  35. // }
  36. }
  37. }
  38. }
  39. }
  40. //gradlew uploadArchives terminal中输入