Ivy: retrieving a snapshot published on Nexus and its dependencies

I use Ivy to publish a snapshot of the embedded Jar in a local Nexus repository using the following Ant target.

<target name="publish">
    <ivy:publish resolver="nexus_snapshot" pubrevision="SNAPSHOT" overwrite="true">
        <artifacts pattern="${dist.dir}/[artifact].[ext]" />
    </ivy:publish>
</target>

This seems to work fine, as a result of which the Jar and its associated ivy.xml are present in the repository (with the file names mymodule-SNAPSHOT.jar and ivy-SNAPSHOT.jar).

Later, in another build of the script, I want to get the Jar and its dependencies (i.e. as indicated in its ivy.xml) into the directory.

This is the Ant target I'm using.

<target name="deploy">
    <delete dir="deploy" />
    <mkdir dir="deploy" />
    <ivy:settings file="${ivy.dir}/ivy_deploy_settings.xml" />
    <ivy:retrieve organisation="myorg" module="mymodule" 
       inline="true" revision="SNAPSHOT" pattern="deploy/[artifact].[ext]"/>
</target>

This returns the Jar to the directory, but not its dependencies. Also, if I add

conf="impl"

to retrieve, it does not work because the configuration was not found.

Thus, it seems that the receipt simply does not reference ivy.xml and therefore does not resolve the dependency.

- ?

+3
1

. , , Nexus POM, Ivy ( - ).

, , POM Jar.

<target name="publish">
    <property name="generated.ivy.file" value="${dist.dir}/ivy.xml" /> 
    <ivy:deliver deliverpattern="${generated.ivy.file}"
        organisation="${ivy.organisation}" 
        module="${ivy.module}" status="integration"
        revision="${ivy.revision}"
        pubrevision="SNAPSHOT"
        conf="impl" />

<ivy:makepom ivyfile="${generated.ivy.file}" 
    pomfile="${dist.dir}/${ivy.module}.pom"/>

    <ivy:publish resolver="nexus_snapshot" pubrevision="SNAPSHOT" 
        publishivy="false" status="integration" overwrite="true">
        <artifacts pattern="${dist.dir}/[artifact].[ext]" /> 
        <artifact name="${ivy.module}" type="pom" ext="pom"/>
    </ivy:publish> 
</target>

, Ivy ( ) POM.

+4

Source: https://habr.com/ru/post/1769320/


All Articles