Gradle artifactory插件无法解析配置阶段的依赖性

编程入门 行业动态 更新时间:2024-10-11 23:15:36
本文介绍了Gradle artifactory插件无法解析配置阶段的依赖性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

apply plugin:'java' apply plugin:'com.jfrog.artifactory' artifactory { contextUrl =$ {artifactory_contextUrl} ... 解析{ repository { repoKey ='repo' username =$ {artifactory_user} password =$ {artifactory_password} maven = true } } } 依赖关系{编译'commons-lang:commons-lang:+'} 任务testCustomResolve { logger.quiet configurations.getByName('compile')。singleFile.absolutePath }

它给了我

无法解析配置':compile'的所有依赖关系。 无法解析外部依赖项commons-lang:commons-lang:+因为没有定义存储库。

它可以作为魅力在执行阶段

任务testCustomResolve<< { logger.quiet configurations.getByName('compile')。singleFile.absolutePath }

或者当我使用mavenCentral()时b

存储库{ mavenCentral()}

解决方案

如果您不需要发布到Artifactory,我注意到,如果不使用 artifactory {} 语法,它会更好。请尝试使用:

插件{ idcom.jfrog.artifactoryversion4.4.10 $ b存储库{ mavenLocal() maven { url$ {artifactory_contextUrl} / $ {artifactory_repo} credentials { username =$ {artifactory_user} password =$ {artifactory_password}} } mavenCentral()}

I am trying to resolve dependency in configuration phase with artifactory gradle plugin.

apply plugin: 'java' apply plugin: 'com.jfrog.artifactory' artifactory { contextUrl = "${artifactory_contextUrl}" ... resolve { repository { repoKey = 'repo' username = "${artifactory_user}" password = "${artifactory_password}" maven = true } } } dependencies { compile 'commons-lang:commons-lang:+' } task testCustomResolve { logger.quiet configurations.getByName('compile').singleFile.absolutePath }

And it gives me

Could not resolve all dependencies for configuration ':compile'. Cannot resolve external dependency commons-lang:commons-lang:+ because no repositories are defined.

It works as a charm in execution phase

task testCustomResolve << { logger.quiet configurations.getByName('compile').singleFile.absolutePath }

or when I use mavenCentral()

repositories { mavenCentral() }

解决方案

In case you don't need to publish to Artifactory, I noticed that it works better if you don't use the artifactory {} syntax. Instead, try using:

plugins { id "com.jfrog.artifactory" version "4.4.10" } repositories { mavenLocal() maven { url "${artifactory_contextUrl}/${artifactory_repo}" credentials { username = "${artifactory_user}" password = "${artifactory_password}" } } mavenCentral() }

更多推荐

Gradle artifactory插件无法解析配置阶段的依赖性

本文发布于:2023-11-30 22:17:52,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:依赖性   插件   阶段   Gradle   artifactory

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!