File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,15 +2,16 @@ apply from: 'config.gradle'
22
33buildscript {
44 repositories {
5- maven {
6- url = uri(" $rootDir /repo" )
7- }
8- jcenter()
95 google()
6+ mavenCentral()
7+ jcenter()
108 maven {
119 url ' https://maven.google.com/'
1210 name ' Google'
1311 }
12+ maven {
13+ url = uri(" $rootDir /repo" )
14+ }
1415 }
1516 dependencies {
1617 classpath ' com.android.tools.build:gradle:4.1.2'
@@ -23,8 +24,9 @@ buildscript {
2324
2425allprojects {
2526 repositories {
26- jcenter()
2727 google()
28+ mavenCentral()
29+ jcenter()
2830 maven {
2931 url ' https://maven.google.com/'
3032 name ' Google'
Original file line number Diff line number Diff line change 11apply plugin : ' com.android.library'
2+ apply plugin : ' maven-publish'
3+ apply plugin : ' signing'
24// apply from: 'dialog_publish.gradle'
35// apply plugin: 'com.novoda.bintray-release'//添加
46
Original file line number Diff line number Diff line change 1- // 教程:https://juejin.cn/post/6951209116521988132
2- apply plugin : ' maven-publish'
3- apply plugin : ' signing'
4-
51task androidSourcesJar (type : Jar ) {
62 archiveClassifier. set(" sources" )
73 from android. sourceSets. main. java. source
@@ -16,12 +12,13 @@ publishing {
1612 // group id,发布后引用的依赖的 group id
1713 groupId ' io.github.fantastic'
1814 // 发布后引用的依赖的 artifact id
19- artifactId ' lib_common_dialog '
15+ artifactId ' lib_dialog '
2016 // 发布的版本
2117 version ' 1.2.0'
2218 // 发布的 arr 的文件和源码文件
2319 artifact(" $buildDir /outputs/aar/${ project.getName()} -release.aar" )
2420 artifact androidSourcesJar
21+ artifact generateJavadoc // 需要上传的java doc
2522 pom {
2623 // 构件名称,可以自定义
2724 name = ' dialog-common'
@@ -87,10 +84,16 @@ publishing {
8784 def releasesRepoUrl = " https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
8885 def snapshotsRepoUrl = " https://s01.oss.sonatype.org/content/repositories/snapshots/"
8986 url = version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl
87+
88+ // maven 对应的用户名和密码自定义存在 local.properties 文件中
89+ Properties properties = new Properties ()
90+ properties. load(project. rootProject. file(' local.properties' ). newDataInputStream())
91+ def mavenUser = properties. getProperty(" sonatypeUsername" )
92+ def mavenPassword = properties. getProperty(" sonatypePassword" )
9093 credentials {
9194 // 这里就是之前在 issues.sonatype.org 注册的账号
92- username ossrhUsername
93- password ossrhPassword
95+ username mavenUser
96+ password mavenPassword
9497 }
9598 }
9699 }
You can’t perform that action at this time.
0 commit comments