常春藤检索导致“找不到模块:org.slf4j#slf4j-api;${slf4j.version}" [英] ivy retrieve leads to "module not found: org.slf4j#slf4j-api;${slf4j.version}"

查看:38
本文介绍了常春藤检索导致“找不到模块:org.slf4j#slf4j-api;${slf4j.version}"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,为什么我能够从一些公共常春藤存储库中提取依赖项,而不是全部?

My question is, why am I able to pull dependencies from some, but not all, of the public ivy repos?

我正在使用 ant build.xml 脚本来调用 ivy:retrieve 命令.这是我的 ivy.xml 文件中的相关行,为了清楚起见,我在其中删除了所有其他依赖项:

I am using an ant build.xml script to call the ivy:retrieve command. Here is the relevant line from my ivy.xml file, where I have removed all of the other dependencies for clarity:

<dependencies>
    <dependency org="log4j" name="log4j" rev="1.2.16"/>
</dependencies>

这是从我的 ivysettings.xml 文件中给出的公共存储库中提取的

which is being pulled from a public repository given in my ivysettings.xml file

<!-- General public repository !-->
    <ibiblio name="public" m2compatible="true"/>

它设法引入了一些依赖项,所以我知道它正在正确访问 ibiblio 存储库.但是构建失败并出现以下错误:

It manages to pull in some of the dependencies, so I know it's accessing the ibiblio repos correctly. However the build fails with the following error:

[ivy:retrieve] 
[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve]      module not found: org.slf4j#slf4j-api;${slf4j.version}
[ivy:retrieve]  ==== public: tried
[ivy:retrieve]    http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.pom
[ivy:retrieve]    -- artifact org.slf4j#slf4j-api;${slf4j.version}!slf4j-api.jar:
[ivy:retrieve]    http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.jar
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      ::          UNRESOLVED DEPENDENCIES         ::
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      :: org.slf4j#slf4j-api;${slf4j.version}: not found
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] 
[ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS

由于某种原因,它无法获取 slf4j 的 jar 依赖项.为什么会这样?如果有帮助,我让一位同事在他们的工作站上使用相同版本的 ant 和 ivy 运行相同的 build.xml 文件,并且构建对他们来说是成功的.如有必要,我可以提供有关我们开发环境的更多信息.

for some reason it cannot grab the jar dependency for slf4j. Why is this happening? If it helps, I've had a coworker run the same build.xml file using the same version of ant and ivy on their workstation, and the build is successful for them. I can provide more info about our dev environments if necessary.

推荐答案

如果您仔细查看控制台输出,您会看到以下内容:

If you take a look closely to console output you will see that in line:

[ivy:retrieve]  ==== public: tried
[ivy:retrieve]    http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.pom
[ivy:retrieve]    -- artifact org.slf4j#slf4j-api;${slf4j.version}!slf4j-api.jar:
[ivy:retrieve]    http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.jar
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      ::          UNRESOLVED DEPENDENCIES         ::
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      :: org.slf4j#slf4j-api;${slf4j.version}: not found
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::

您正在尝试解析位于以下位置的资源:

you trying to resolve resource located at:

[ivy:retrieve]    http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.pom

和 ${slf4j.version} - 是一个由于某种原因没有被实例化的变量.可能会遗漏build.properties/ivy.properties,或者这个变量应该直接在build.xml/ivy.settings/ivysettings.xml/whatever_file_define_resolve_variables.xml中定义.但是因为它没有被定义为常春藤试图获取恰好位于

and ${slf4j.version} - is a variable that was not instantiated for some reason. May be missed build.properties/ivy.properties, or this variable should be defined directly in build.xml/ivy.settings/ivysettings.xml/whatever_file_define_resolve_variables.xml. But since it was not defined ivy trying to get resource located at exactly

http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.pom

而不是像

http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.9/slf4j-api-1.7.9.pom

因此,要运行解析,您应该以某种方式定义名为slf4j.version"的变量.尝试搜索如何为 ivy 或 ant 定义变量.有不同的方法可以做到这一点.

So to get resolve running you should define variable called 'slf4j.version' some way. Try to search how to define variables for ivy or for ant. There is different ways to do that.

这篇关于常春藤检索导致“找不到模块:org.slf4j#slf4j-api;${slf4j.version}"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆