【发布时间】:2016-04-04 23:06:52
【问题描述】:
使用的插件有:“com.jfrog.artifactory”和“maven-publish”
根 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'
}
}
}
还有应用程序 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")
}
}
问题是 apk 没有上传到 Artifactory,正在上传构建描述符,一切看起来都很好,只是没有 apk 工件(apk 已构建,我已经验证它存在并且命名正确并且在正确的路径)。
输出:
$ ./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
【问题讨论】:
-
我在推测,但根项目没有 maven 发布。如果您将
artifactory{}部分添加到应用程序 build.gradle 会怎样? -
将
artifactory{}添加到应用程序 build.gradle 没有任何区别。
标签: android gradle publish artifactory