I’ve got a multi-project build that has some libraries that need to be published. I’d like to declare the repositories to publish them to in my root build.gradle and have the few projects that need to publish things declare what publications they need to publish, but inherit the repositories.
I’ve tried putting this publishing section in all the possible places I could think of in my root build.gradle:
publishing {
repositories {
mavenLocal()
if (!rikerVersion.contains("SNAPSHOT")) {
maven { url 'https://nexus.corp.company.com/content/repositories/android-public' }
}
}
}
And then the few child projects that have something to publish look like this:
publishing {
//repositories {
//
mavenLocal()
//
if (!rikerVersion.contains("SNAPSHOT")) {
//
maven { url 'https://nexus.corp.company.com/content/repositories/android-public' }
//
}
//}
publications {
maven(MavenPublication) {
groupId 'com.company.cardreader'
artifactId 'cardreader-native'
version rootProject.ext.rikerVersion
artifact source: file('src/main/libs/armeabi/libcardreader-native.so'), classifier: 'armeabi'
artifact source: file('src/main/libs/armeabi-v7a/libcardreader-native.so'), classifier: 'armeabi-v7a'
}
}
}
How do I share this publishing repository information across projects?