File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 11plugins {
22 id ' com.android.application' version ' 8.4.2' apply false
33 id ' org.jetbrains.kotlin.android' version ' 1.6.21' apply false
4+ id ' maven-publish'
45}
56
67tasks. register(' clean' , Delete ) {
Original file line number Diff line number Diff line change 11apply plugin : ' com.android.library'
2+ apply plugin : ' maven-publish'
23apply from : ' ../common.gradle'
34
45android {
@@ -17,4 +18,32 @@ android {
1718 packageLib. exclude ' R.txt'
1819 }
1920 }
21+ }
22+
23+ publishing {
24+ publications {
25+ release(MavenPublication ) {
26+ groupId = ' com.github.getActivity'
27+ artifactId = ' Toaster'
28+ version = android. defaultConfig. versionName
29+ // 指定 aar 文件的确切路径:https://cloud.tencent.com/developer/ask/sof/106381154
30+ afterEvaluate {
31+ artifact(bundleReleaseAar)
32+ }
33+
34+ // 修正 Maven 插件在生成的 pom 文件没有携带 dependencies 信息的问题
35+ // 用于测试 Gradle 命令:./gradlew publishToMavenLocal
36+ // 相关 Github 地址:https://github.com/getActivity/XXPermissions/issues/371#issuecomment-3018735968
37+ pom. withXml {
38+ def dependencies = asNode(). appendNode(' dependencies' )
39+ configurations. implementation. allDependencies. each {
40+ def dependency = dependencies. appendNode(' dependency' )
41+ dependency. appendNode(' groupId' , it. group)
42+ dependency. appendNode(' artifactId' , it. name)
43+ dependency. appendNode(' version' , it. version)
44+ dependency. appendNode(' scope' , ' runtime' )
45+ }
46+ }
47+ }
48+ }
2049}
You can’t perform that action at this time.
0 commit comments