How to publish Android .aar sources to make Android Studio automatically find them?

后端 未结 2 855
执笔经年
执笔经年 2021-01-31 22:04

I\'m publishing libraries to an internal Sonatype Nexus repository.

Android Studio has a feature that automatically finds the correct source for a library that is refere

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-31 22:21

    I have wrote a gradle plugin for this function. Hope it will help you.

    ----- edit ------

    How to publish Android .aar sources?

    android {
    
        task sourcesJar(type: Jar) {
            classifier = 'sources'
            from android.sourceSets.main.java.srcDirs
        }
    
        artifacts {
            archives sourcesJar
        }
    
        uploadArchives {
            repositories {
                mavenDeployer {
                    ...
                }
            }
        }
    }
    

提交回复
热议问题