Reputation: 153
Plugins being used are: 'com.jfrog.artifactory' and 'maven-publish'
The root build.gradle:
buildscript {
repositories {
maven {
url 'http://localhost:8081/artifactory/globalmaven'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0"
}
}
allprojects {
repositories {
maven {
url 'http://localhost:8081/artifactory/globalmaven'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
group = 'com.my.package'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
artifactoryPublish {
clientConfig.info.setBuildName('My_special_build_name')
clientConfig.info.setBuildNumber('1')
}
artifactory {
contextUrl = 'http://localhost:8081/artifactory'
publish {
repository {
repoKey = 'Libs-snapshot-local'
username = project.getProperties().artifactory_user
password = project.getProperties().artifactory_password
}
defaults {
publishArtifacts = true
publishPom = false
publishIvy = false
}
}
resolve {
repository {
repoKey = 'globalmaven'
}
}
}
And the app build.gradle
apply plugin: 'com.android.application'
version = "1.0"
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.my.package"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName version
}
buildTypes {
debug {
versionNameSuffix "-SNAPSHOT"
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:23.0.1'
}
publishing.publications {
apk(MavenPublication) {
groupId group
artifactId 'MyArtifact'
artifact("$buildDir/outputs/apk/${project.getName()}-debug.apk")
}
}
The problem is that the apk is not uploaded to Artifactory, the build descriptor is being uploaded and everything looks good just no apk artifact (The apk is built, I've verified that it exists and is named correctly and is in the correct path).
Output:
$ ./gradlew artifactoryPublish
[buildinfo] Not using buildInfo properties file for this build.
:artifactoryPublish
Deploying build descriptor to: http://localhost:8081/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under http://localhost:8081/artifactory/webapp/builds/My_special_build_name/1
BUILD SUCCESSFUL
Upvotes: 1
Views: 8237
Reputation: 32083
Firstly, I'm not sure publishing an apk to Artifactory is what you want. Is it an Android application (apk) or an Android library (aar) that you want to publish to Artifactory? Either way, Owais Ali is correct. You need to specify in your project's root-level build.gradle
what is to be published, as follows:
artifactory {
defaults {
publications('apk')
publishArtifacts = true
publishPom = true
}
}
Even then, I think you might still encounter some further problems. See this Stack Overflow thread for a similar problem that I encountered and the solution that I came to:
Gradle Artifactory Plugin - How to publish artifacts from multiple modules in a project?
Upvotes: 1
Reputation: 724
You need to tell the artifactory plugin what it is you want published. Check the publications/publishConfigs properties on the artifactory plugin.
Upvotes: 2