几天来,我一直在尝试向Artifactory部署gradle项目,但是我的任何尝试都成功了!
我正在使用Artifactory 6.1.0并通过gradle来消除氧气释放
我在Artifactory中创建了一个管理员用户和一个gradle存储库
我将代码(从存储库的生成设置中添加)到build.gradle文件中,这里是内容
//In fact I am not sure if I need all of them!?
apply plugin: 'java-library'
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'
buildscript {
repositories {
jcenter()
}
dependencies {
//Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
}
}
allprojects {
apply plugin: "com.jfrog.artifactory"
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'xyz_reposit'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
resolve {
repository {
repoKey = 'gradle-dev'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
publishing {
publications {
maven(MavenPublication) {
groupId = 'myGroup'
artifactId = 'myProject'
version = '1.0.0'
from components.java
}
}
}
并且配置了gradle.properties
artifactory_user=Admin
artifactory_password=password
artifactory_contextUrl=http://localhost:8081/artifactory
当我执行artifactoryDeploy时,将结果发布到cmd中
当我回到Artifactory时,xyz存储库中什么都没有发布!?您能帮我吗?我很确定build.gradle代码中缺少什么?!
答案 0 :(得分:0)
您使用的是什么版本?我建议更新到最新的5.4.1
第二,您还应该在执行gradlew artifactoryPublish
之后执行artifactoryDeploy
。
要查看运行命令的区别:
gradlew tasks
答案 1 :(得分:0)
我遇到了类似的问题,而我最能帮助的是一个运行中的例子
https://github.com/jfrog/project-examples/tree/master/gradle-examples/gradle-android-example