ivy retrieve leads to “module not found: org.slf4j#slf4j-api;${slf4j.version}”

牧云@^-^@ 提交于 2019-12-06 02:43:15

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

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

instead of something like

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

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.

Cannot reproduce your problem.

Example

├── build.xml
├── ivysettings.xml
├── ivy.xml
└── lib
    ├── activation-1.1.jar
    ├── geronimo-jms_1.1_spec-1.0.jar
    ├── log4j-1.2.16.jar
    ├── log4j-1.2.16-javadoc.jar
    ├── log4j-1.2.16-sources.jar
    └── mail-1.4.1.jar

build.xml

<project name="demo" default="build" xmlns:ivy="antlib:org.apache.ivy.ant">

    <target name="build">
        <ivy:retrieve pattern="lib/[artifact]-[revision](-[classifier]).[ext]"/>
    </target>

    <target name="clean">
        <delete dir="lib"/>
        <ivy:cleancache/>
    </target>

</project>

ivy.xml

<ivy-module version="2.0">
    <info organisation="com.myspotontheweb" module="demo"/>

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

</ivy-module>

ivysettings.xml

<ivysettings>
  <settings defaultResolver="central" />
  <resolvers>
    <ibiblio name="central" m2compatible="true"/>
  </resolvers>
</ivysettings>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!