最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ant - Apache Ivy not able to resolve m:classifier - Stack Overflow

programmeradmin3浏览0评论

I have created a jfrog artifactory repository and it is of type maven, I have a build.xml which I want to use to extract some files from this repository. I am using apache ant integration with apache ivy to download these files. Everything works okay and I am able to download files when I use build.xml,ivysettings.xml and define dependency in ivy.xml.

Now I don't want to use ivy.xml but wanted to put dependencies directly in the build.xml. I am using m:Classifier in the artifact name, so when I try to run ant the m:classifier value is not going inside the artifact pattern in ivysettings.xml file, hence the file is not able to download

Below is my Build.xml

<project name="MyProject" default="resolve-and-move" basedir="." xmlns:ivy="antlib:.apache.ivy.ant" xmlns:m="; >
    <!-- Define Ivy task -->
    <taskdef name="ivy" classname=".apache.ivy.ant.IvyTask" classpath="C:\apache-ant-1.10.15-bin\apache-ant-1.10.15\lib\ivy-2.5.3.jar"/>

    <!-- Load Ivy settings -->
    <ivy:settings file="ivysettings.xml"/>

    <!-- Define dependencies directly in build.xml -->
    <target name="resolve1" description="Retrieve dependencies (download files)">
    <ivy:resolve>
        <dependency ="software" name="7z" rev="1806">
            <artifact name="7z" m:classifier="x64" ext="exe"/>
        </dependency>
    </ivy:resolve>  
    </target>
    
    <!-- Retrieve dependencies (download files) -->
    <target name="retrieve1" description="Retrieve dependencies (download files)">
        <ivy:retrieve pattern="lib/[artifact]-[revision](-[classifier]).[ext]" />
    </target>

    <!-- Resolve, Retrieve, then Copy and Rename -->
    <target name="resolve-and-move" depends="resolve1, retrieve1" />
</project>

Below is my ivysettings.xml file

<ivysettings>
    <settings defaultResolver="main"  />
    <credentials host="someiphere" realm="Artifactory Realm" username="admin" passwd="password" />
    <resolvers>
        <chain name="main">
            <!-- Resolver for exe files -->
            <url name="exe-resolver" m2compatible="true">
                <artifact pattern="http://someiphere:8081/artifactory/ATS8/[anisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />
            </url>
            
        </chain>
    </resolvers>
</ivysettings>

the error I am getting is like below

ivy:resolve] :: downloading artifacts ::
[ivy:resolve]           tried http://someiphere:8081/artifactory/ATS8/software/7z/1806/7z-1806.exe
[ivy:resolve] CLIENT ERROR: Not Found url=http://someiphere:8081/artifactory/ATS8/software/7z/1806/7z-1806.exe
[ivy:resolve] WARN:     [NOT FOUND  ] software#7z;1806!7z.exe(*) (360ms)
[ivy:resolve] WARN: ==== exe-resolver: tried
[ivy:resolve] WARN:     http://someiphere:8081/artifactory/ATS8/software/7z/1806/7z-1806.exe
[ivy:resolve] :: resolution report :: resolve 87ms :: artifacts dl 376ms
        ---------------------------------------------------------------------
        |                  |            modules            ||   artifacts   |
        |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
        ---------------------------------------------------------------------
        |      default     |   1   |   0   |   0   |   0   ||   1   |   0   |
        ---------------------------------------------------------------------

The correct url is url=http://someiphere:8081/artifactory/ATS8/software/7z/1806/7z-1806-x64.exe

so what is happening is classifier value is not going from build.xml to ivysettings.xml file, when I separately create ivy.xml file, then the resolution works okay and classifier value is going inside ivysettings.xml file

I can do workarounds to solve this, like not having classifier value and put that in artifact name only. But I am not able to solve this with classifier, I am not sure what I am missing but any help would be much appreciated.

发布评论

评论列表(0)

  1. 暂无评论