我一直坚持将artifactory 3.0.1 插件与Gradle 集成。我使用的是 Android Studio 1.0,所以我猜我使用的是 Gradle 2.0。任何有关使用 3.0.1 插件发布到神器的示例都会非常有帮助。
提前致谢
发布到 Artifactory 只是一项配置任务。你只需要配置两个插件,com.jfrog.artifactory
and maven-publish
,然后运行artifactoryPublish
摇篮任务。但是...让我们用代码来解释它,以方便复制粘贴:·)
在你的图书馆build.gradle
:
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
publishing {
publications {
aar(MavenPublication) {
groupId 'com.fewlaps.something' //put here your groupId
artifactId 'productname' //put here your artifactId
version '7.42.0' //put here your library version
// Tell maven to prepare the generated "*.aar" file for publishing
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
}
}
}
artifactory {
contextUrl = 'https://your-artifactory-host.com/artifactory'
publish {
repository {
repoKey = "libs-release-local"
username = "username"
password = "password"
}
defaults {
// Tell the Artifactory Plugin which artifacts should be published to Artifactory.
publications('aar')
}
}
}
然后,运行./gradlew artifactoryPublish
此外,如果您想在每次将标签推送到 GitHub 时上传工件,请将此代码添加到您的.travis.yml
deploy:
- provider: script
script: ./gradlew artifactoryPublish
skip_cleanup: true
on:
tags: true
如果当您将标签推送到 GitHub 时它没有启动该标签的构建,请检查您是否正在构建vX.X.X
特拉维斯的标签:
# Build only master and "vX.X.X" tags to prevent flooding Travis machines
branches:
only:
- master
- /^v\d+\.\d+\.\d+$/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)