Reputation: 539
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!
Upvotes: 1
Views: 1775
Reputation: 8090
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')
Upvotes: 2
Reputation: 29912
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?
Upvotes: 1
Reputation: 11413
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.
Upvotes: 0