PCM*_*PCM 10 android gradle maven android-studio android-gradle-plugin
我正在尝试使用gradle设置工件(APK/aar文件)构建过程,类似于我习惯使用maven.
mvn release:prepare (Adjusts version, checks into SVN, creates the tag)
mvn release:perform -Dgoals=deploy (Pushes the artifact to http://artifactory.XXX.local/artifactory/libs-releases-local/)
Run Code Online (Sandbox Code Playgroud)
我希望能够运行gradle命令并获得类似的结果.我正在使用https://github.com/researchgate/gradle-release插件进行发布管理(工作正常,因此我对发布很好).但是当我运行命令时gradlew artifactoryPublish,工件被部署在其他位置(就好像它不尊重gradle文件中的repoKey)
D:\ my-lib-android-0.0.2> gradlew artifactoryPublish ...... [buildinfo]不使用buildInfo属性文件进行此构建.:artifactoryPublish将构建描述符部署到: http://artifactory.XXX.local/artifactory/api/build构建成功部署.在http://artifactory.XXX.local/artifactory/webapp/builds/my-lib-android-0.0.2/1449880830949下的Artifactory中浏览它 >
建立成功
总时间:9.692秒
所以我的问题是如何修复我的设置,以便将工件推送到类似于此的URL:
http://artifactory.XXX.local/artifactory/libs-releases-local/com/example/my-lib-android/0.0.2/my-lib-android-0.0.2.aar
Run Code Online (Sandbox Code Playgroud)
build.gradle文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.1.2')
classpath 'net.researchgate:gradle-release:2.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'net.researchgate.release' version '2.3.4'
}
apply plugin: "com.jfrog.artifactory"
apply plugin: 'maven-publish'
apply plugin: 'net.researchgate.release'
allprojects {
repositories {
jcenter()
maven {
url 'http://artifactory.XXX.local/artifactory/libs-releases-local'
}
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
//The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = "libs-releases-local"
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
release {
revertOnFail = false
}
task build{
}
Run Code Online (Sandbox Code Playgroud)
gradle.properties文件:
version=my-lib-android-0.0.3-SNAPSHOT
artifactory_user=myUserName
artifactory_password=myPasssword
artifactory_contextUrl=http://artifactory.XXX.local/artifactory
Run Code Online (Sandbox Code Playgroud)
使用android-maven插件:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.2'
classpath 'com.github.dcendents:android-maven-plugin:1.0'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.2.0'
}
}
apply plugin: 'android-library'
apply plugin: 'com.jfrog.artifactory-upload'
apply plugin: 'android-maven'
configurations {
published
}
task sourceJar(type: Jar) {
from android.sourceSets.main.java
classifier "sources"
}
artifactoryPublish {
dependsOn sourceJar
}
artifacts {
published sourceJar
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = "libs-releases-local"
username = "${artifactory_user}"
password = "${artifactory_password}"
}
defaults {
publishConfigs('archives', 'published')
publishPom = true //Publish generated POM files to Artifactory (true by default)
publishIvy = false //Publish generated Ivy descriptor files to Artifactory (true by default)
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
895 次 |
| 最近记录: |