我坚持将artifactory 3.0.1插件与Gradle集成。我使用的是Android Studio 1.0,所以我猜测我是在使用Gradle 2.0。使用3.0.1插件发布到artifactory的任何示例都非常有用。
提前致谢
答案 0 :(得分:0)
JFrog发布了一个向Artifactory发布aar的完整功能示例。 Here you go。选择您使用的插件版本并查看示例。
答案 1 :(得分:0)
发布到Artifactory只是一项配置任务。您只需配置两个插件com.jfrog.artifactory
和maven-publish
,然后运行artifactoryPublish
Gradle的任务。但是......让我们通过代码来解释它,以简化复制:·)
在您的图书馆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时没有为标记启动构建,请检查您是否在Travis上构建了vX.X.X
标记:
# Build only master and "vX.X.X" tags to prevent flooding Travis machines branches: only: - master - /^v\d+\.\d+\.\d+$/