Reputation: 1968
I'm publishing some source sets successfully to maven repository but I really need to public my .aar
library instead.
I'm using this tutorial
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}
And with this code as I understand it sends to repository my soucrse sets but when I try to send my aar it says that the rote to .aar
is not correct with this code:
from android.lib.build.outputs.sourceFiles
So how can I send my file located at \project\lib\build\outputs\aar\my_aar.aar
?
EDIT: as lase
said this connects to maven with credentials BUT doesn't deploy aar:
mavenDeployer {
def credentials = [
userName: NEXUS_USERNAME,
password: NEXUS_PASSWORD
]
repository(url: "test",authentication:credentials)
pom.artifactId = 'com.liv'
pom.version = '1.5.0'
pom.packaging = 'aar'
pom.groupId = 'test2'
}
And unfurtunately this code doesn't upload anything without this to maven repository:
afterEvaluate { project ->
signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}
artifacts {
archives androidSourcesJar
}
}
EDIT: maybe this project has specific SourceSets so I would post it:
sourceSets {
main {
java.srcDirs = ['src/main/java']
res.srcDirs = ['src/main/res']
assets.srcDirs = ['assets']
}
liv {
java.srcDirs = ['src/live/java']
res.srcDirs = ['src/live/res']
assets.srcDirs = ['src/main/assets']
manifest.srcFile 'src/live/AndroidManifest.xml'
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
}
live {
java.srcDirs = ['src/live/java']
res.srcDirs = ['src/live/res']
assets.srcDirs = ['src/main/assets']
manifest.srcFile 'src/live/AndroidManifest.xml'
}
}
Upvotes: 4
Views: 2100
Reputation: 2634
I'm doing exactly that using this strategy. My applied plugins are com.android.library
and maven
.
android {
...
uploadArchives {
repositories {
mavenDeployer {
repository(url: "http://mycompany/local/repositories/releases/")
pom.artifactId = 'projectName'
pom.version = '1.0.0'
pom.packaging = 'aar'
pom.groupId = 'com.mycompany'
}
}
}
Upvotes: 1