我在将artifactory 3.0.1插件与Gradle集成时遇到了困难。我正在使用Android Studio 1.0,因此我猜测我正在使用Gradle 2.0。如果有关于使用3.0.1插件发布到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' //在此处放置您的groupId artifactId 'productname' //在此处放置您的artifactId version '7.42.0' //在此处放置您的库版本然后,运行
// 告诉maven为发布准备生成的“*.aar”文件 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 { //告诉Artifactory插件应该将哪些构件发布到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
标签:
#仅构建主分支和“vX.X.X”标签,以防止洪水般的Travis机器 branches: only: - master - /^v\d+\.\d+\.\d+$/
from components.release
简单地配置Maven发布。除此之外,这个答案仍然是准确的。请参阅https://developer.android.com/studio/build/maven-publish-plugin。 - Big McLargeHuge