मैं w परियोजना प्रति कई कलाकृतियों को अपलोड करने की कोशिश कर रहा हूँ/Maven Gradle प्लगइन:कई एंड्रॉयड अभिलेखागार अपलोड करने के लिए कैसे (प्रत्येक स्वाद के लिए एक)
http://www.gradle.org/docs/current/userguide/maven_plugin.html
53.6.4.1. Multiple artifacts per project
Maven can only deal with one artifact per project. This is reflected in the structure of the Maven POM. We think there are many situations where it makes sense to have more than one artifact per project. In such a case you need to generate multiple POMs. In such a case you have to explicitly declare each artifact you want to publish to a Maven repository. The MavenDeployer and the MavenInstaller both provide an API for this:
Example 53.9. Generation of multiple poms
build.gradle
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file://localhost/tmp/myRepo/")
addFilter('api') {artifact, file ->
artifact.name == 'api'
}
addFilter('service') {artifact, file ->
artifact.name == 'service'
}
pom('api').version = 'mySpecialMavenVersion'
}
}
}
You need to declare a filter for each artifact you want to publish. This filter defines a boolean expression for which Gradle artifact it accepts. Each filter has a POM associated with it which you can configure. To learn more about this have a look at PomFilterContainer and its associated classes.
सच कि मैं क्या करने की कोशिश कर रहा हूँ मेरे निर्माण के विभिन्न स्वादों के लिए अलग-अलग अभिलेखागार अपलोड करना है।
apply plugin: 'com.android.library'
apply plugin: 'maven'
group 'com.test'
version '0.0.1'
android {
compileSdkVersion 19
buildToolsVersion "21.1.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
lintOptions {
abortOnError false
}
productFlavors {
flavor1 { }
flavor2 { }
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file://${System.properties['user.home']}/.m2/repository")
addFilter('debugFlavor1') { artifact, file ->
artifact.name.contains("debugFlavor1")
}
addFilter('releaseFlavor1') { artifact, file ->
artifact.name.contains("releaseFlavor1")
}
addFilter('debugFlavor2') { artifact, file ->
artifact.name.contains("debugFlavor2")
}
addFilter('releaseFlavor2') { artifact, file ->
artifact.name.contains("releaseFlavor2")
}
pom('debug').artifactId = ${artifactId} + "-" ${flavor} + "-debug"
pom('release').artifactId = ${artifactId} + "-" ${flavor}
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.0.2'
compile 'org.apache.commons:commons-lang3:3.3.2'
}
यह संभव तरह कुछ है:
यहाँ अपनी परियोजनाओं build.gradle फ़ाइल है?
मैं प्रत्येक प्रकाशित में artifactId और स्वाद पर कैसे प्राप्त करूं? मैंने $ {artifactId} और $ {स्वाद} प्लेसहोल्डर्स के रूप में उपयोग किया लेकिन मुझे पता है कि यह सही नहीं है।
संपादित करें:
ठीक है मैं पता लगा कि कैसे प्रत्येक स्वाद के लिए एक अलग विरूपण साक्ष्य मिलता है।
publishNonDefault true
लेकिन जब मुझे लगता है कि मैं एक विरूपण साक्ष्य के लिए एक पोम फ़ाइल नहीं मिलता कार्य करें: चाबियों का एक सेट करने के लिए किया गया था। मेरे पास संक्रमणीय निर्भरताएं हैं जिन्हें खींचने की आवश्यकता है और मुझे नहीं लगता कि वे बिना किसी पोम के खींचे जाएंगे।
यहां मेरी वर्तमान ग्रेडल स्क्रिप्ट है, मैं प्रत्येक के लिए एक पोम कैसे उत्पन्न करूं।
apply plugin: 'com.android.library'
apply plugin: 'maven'
group 'com.test'
version '0.0.1'
android {
compileSdkVersion 19
buildToolsVersion "21.1.1"
publishNonDefault true
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
productFlavors {
flavor1 {}
flavor2 {}
}
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file://${System.properties['user.home']}/.m2/repository")
addFilter('flavor1Release') { artifact, file ->
artifact.attributes.classifier.equals("flavor1Release")
}
addFilter('flavor2Release') { artifact, file ->
artifact.attributes.classifier.equals("flavor2Release")
}
pom('flavor1Release').artifactId = project.archivesBaseName + "-flavor1"
pom('flavor2Release').artifactId = project.archivesBaseName + "-flavor2";
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.0.2'
compile 'org.apache.commons:commons-lang3:3.3.2'
}
मैं ठीक उसी समस्या है ... :( – David
आप इस का समाधान है? –
सच यह करने के लिए कोशिश कर रहा द्वारा Maven रेपो लड़ रहे हैं। मैं आइवी लता रेपो की कोशिश की लेकिन ग्रेडल एक ही समय में डिफ़ॉल्ट और गैर डिफ़ॉल्ट कलाकृतियों का निर्माण नहीं करेगा। मैंने प्रोजेक्ट को केवल एक एसडीके रखने के लिए प्रोजेक्ट किया है और ऐप में स्वाद डाला है, यह एसडीके पर निर्भर करता है। – lostintranslation