Can somebody give me a hint on how to use the maven-publish gradle plugin to publish a com.android.library project/module with aar and source jar? I am able to do this with the old maven plugin - but I would like to use the new maven-publish plugin.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
You can also use the android maven plugin. It creates the .aar, javadoc.jar, sources.jar and .pom and updates the maven-metadata.xml after uploading the files to the maven repository. I also put the script on GitHub.
Call it with
Here is my improved solution, based on other answers.
Gist: https://gist.github.com/Robyer/a6578e60127418b380ca133a1291f017
Changes from other answers:
classifier
- it must be"sources"
(not"source"
)Handles dependencies
@aar
andtransitive: false
. In that case we set exclusion in POM to ignore all transitive dependencies of this dependency.Supports also custom exclude rules on dependencies, e.g.:
Changelog:
bundleRelease
tobundleReleaseAar
as it was changed in new Gradle (see this answer)getAllDependencies
togetDependencies
to fix duplicated resulting entries (as mentioned in comments on my Gist).If you want to avoid boilerplate codes, because the
maven-publish
plugin do not write dependencies into pom.xmlTry this plugin: android-maven-publish
Here's a sample using the new
maven-publish
plugin.Publish with
./gradlew clean build publish
A little tweak to dskinners answer with correct dependency generation:
And you can change
version
andgroupId
by defining: