简体   繁体   中英

gradle uploadArchives task to upload single flavor

i have an app with multiple product flavors. im using the maven plugin and the uploadArchives task to upload my apk to nexus, using this: https://raw.githubusercontent.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle

my problem is running uploadArchives runs the build and assemble tasks for all flavors and uploads them to my nexus repo.

i want to be able to assemble and upload a single flavor and not necessarily all of them .

i dont understand exactly what uploadArchives does, why does it assemble the app ? shouldnt it only upload whatever was generated by an explicit assemble task? how do i run it per flavor?

Thanks!

My solution to this problem was to create another module that references the specific flavor and use uploadArchives on that module.

To add a dependency to a specific flavor use this line in your Gradle dependency section:

compile project(path: ':lib', configuration: 'flavor')

The upload to the repository should upload all artifacts from the build, which in this case includes all flavours. This way you can guarantee that all artifacts in the repository are from the same codebase.

What is your use case to upload only some?

You should be able to just build the productFlavor your interested in. For example

gradle clean assembleMyProductFlavor uploadArchives Then the upload should only see the flavor your interested as the other apk files don't exist.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM