gradle - 将 gradle 项目部署到 Artifactory
问题描述
几天来,我试图将一个 gradle 项目部署到 Artifactory,但我的任何尝试都成功了!
我正在使用 Artifactory 6.1.0 和 gradle on ecipe 氧气释放
我在 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 代码中缺少某些东西?!
解决方案
您使用的是什么版本的版本?我建议更新到最新的 5.4.1
其次,您还应该gradlew artifactoryPublish
在做完artifactoryDeploy
.
要查看命令的差异,请运行:
gradlew tasks
推荐阅读
- python - 在 Qt 中结合数据和图形表示的最佳方式
- html - 是否有一个平台可以在没有 Mac 的情况下在高中课堂环境中为 iOS 开发 HTML5 应用程序?
- python - 将非类回调指向类方法
- ios - AVPlayerViewController 内存泄漏/保留周期?
- php - 使用 PHP 的嵌套数组 JSON
- docker - docker-compose healthcheck 无法以预期的方式工作,即先运行容器 a,然后运行容器 B
- java - 如何将一个 json 转换为 TestResult
- swift - Json数组字典在swift 5中解析nil
- c# - 使用 MissingMemberHandling.Error 反序列化时不会忽略具有 JsonIgnore 属性的属性
- sql - 无法加载文件或程序集 microsoft.sqlserver.management.sdk.sfc 版本=11.0.0.0 文化=中性 publickeytoken