You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Vincent Case <vi...@gmail.com> on 2016/11/02 17:36:14 UTC

Issue Publishing with UrlResolver and later Resolving with IBiblioResolver

Problem Overview: My goal is to publish an artifact using the UrlResolver
and then retrieve it using the IBiblioResolver.  However, resolve fails if
the dependency conf mapping is to something other than "->default".   What
I observe is:
1- The ivy:resollve task succeeds if the UrlResolver is used for resolving
as well as publishing.
2- The ivy:resolve task succeeds with the IBiblioResolver only if the conf
mapping is to the "->default" for the published artifact.
3- When the dependency conf mapping is to something other than ->default,
verbose logging indicates that "no ivy file file found for XXX: using
default data"
4- When the "m2compitiblity" settings are the same for publish and resolve,
the failure is always the same, regardless of its setting, and regardless
of the "usepoms" setting.

I have created a trivial example (below) that exhibits the behavior
described above.

Thanks for your help.

=== settings.properties ===
pattern.artifacts.pub=[organization]/[module]/[revision]/[type]s/[artifact].[ext]
pattern.ivy.pub=[organization]/[module]/[revision]/[type]s/[artifact].[ext]

=== settings.xml ===
<ivysettings>
<properties file="settings.properties" override="false" />
<settings defaultResolver="resolver-res" />

<resolvers>
<url name="resolver-pub" m2compatible="false" >
<artifact pattern="${artifactory.url}/${rps.repo.integration}/${pattern.artifacts.pub}"
/>
<ivy      pattern="${artifactory.url}/${rps.repo.integration}/${pattern.ivy.pub}"
/>
</url>
<ibiblio name="resolver-res" m2compatible="true" usepoms="false"
root="${artifactory.url}/${rps.repo.integration}"
pattern="${pattern.artifacts.pub}"
/>
</resolvers>
</ivysettings>


=== ivy.xml for Publish ===
<ivy-module version="2.0">
<info organisation="com.vcase.rps" module="pub"/>

<configurations>
<conf name="compile" visibility="private" />
<conf name="runtime" extends="compile"/>
</configurations>

<publications>
<artifact/>
</publications>
</ivy-module>

=== ivy.xml for Resolving the published artifact ===
<ivy-module version="2.0">
<info organisation="com.vcase.rps" module="res"/>

<configurations>
<conf name="compile" visibility="private" />
<conf name="runtime" extends="compile"/>
</configurations>

<dependencies>
<dependency org="com.vcase.rps" name="pub" rev="latest.integration"
transitive="false" conf="compile->runtime" />
</dependencies>
</ivy-module>

=== Build File ===
<project name="delme" default="resolve" basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant" >

<property environment="env" />
<property file="settings.properties" />

<property name="IvyJarFile"
value="c:/dev/apache-ivy-2.4.0/build/artifact/jars/ivy.jar" />
<taskdef
classpath="${IvyJarFile}"
resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant"
/>

<target name="init" depends="clean" description="Initialize for the build" >
<ivy:configure file="settings.xml"/>
</target>


<target name="publish" depends="init" description="Publish archives">
<ivy:resolve file="ivy-pub.xml" />
<echo file="pub.jar" >file:pub.jar</echo>
<ivy:publish
artifactspattern="${basedir}/${pattern.artifacts.built}"
resolver="resolver-pub"
pubrevision="1.0"
forcedeliver="true"
status="integration"
overwrite="true"
conf="compile,runtime"
/>
</target>


<target name="resolve" depends="init" >
<ivy:resolve file="ivy-res.xml" type="jar" conf="*(public)" />
</target>


<target  name="clean">
<delete dir="c:/Users/vcase/.ivy2" includeemptydirs="true" verbose="true" />
<delete dir="c:/dev/devOpsProject/RpsApp/.ivy-internal-cache"
includeemptydirs="true" />
<delete dir="c:/dev/devOpsProject/RpsApp/.ivy-local-repo"
includeemptydirs="true" />
</target>
</project>



=== Verbose Logging Output ====

[ivy:resolve]           tried http://centos-7:8882/
artifactory/rps-integration/com/vcase/rps/pub/[revision]/jars/pub.jar
[ivy:resolve]   resolver-res: no ivy file found for
com.vcase.rps#pub;latest.integration: using default data
[ivy:resolve]           [1.0] com.vcase.rps#pub
:
:
[ivy:resolve]           :: com.vcase.rps#pub;1.0: configuration not found
in com.vcase.rps#pub;1.0: 'runtime'. It was required from
com.vcase.rps#;working@vcase-PC-new compile


EOM

Re: Issue Publishing with UrlResolver and later Resolving with IBiblioResolver

Posted by Vincent Case <vi...@gmail.com>.
Thank you for your very clear explanation.  I will use the url resolver for
both publishing the resolving.

-Vincent

On Wed, Nov 2, 2016 at 2:10 PM, Geißler, Daniel <
daniel.geissler@salt-solutions.de> wrote:

> The ibiblio resolver is for dependency resolution in maven repositories.
> If you don't publish a pom.xml then resolving might be somewhat strange.
>
> So you'll need to create a pom first: http://ant.apache.org/ivy/
> history/2.4.0/use/makepom.html where you can map your ivy configurations
> to maven scopes.
> Add the pom to your publish section in the ivy.xml and try it again.
>
> When resolving with the ibiblio resolver you are however bound to
> automatically created configurations that meet the maven scopes (master,
> compile, test ...). As far as I remember default is a combination of master
> (the artifact itself) and runtime (it's runtime dependencies).
>
> When publishing with ivy.xml the url resolver should be sufficient and
> even faster than ibiblio.
>
> Hope that helps.
>
> Kind regards
> Daniel
>
> _____________________________________
>
> www.salt-solutions.de
>
> Geschäftsführer: Dr. Bernhard Blüthner, Norbert H. Fiedler, Dieter Heyde,
> Markus Honold
> Sitz: München, AG München, HRB 146081
>
> -----Ursprüngliche Nachricht-----
> Von: Vincent Case [mailto:vincent.case@gmail.com]
> Gesendet: Mi, 2. November 2016 18:36
> An: ivy-user@ant.apache.org
> Betreff: Issue Publishing with UrlResolver and later Resolving with
> IBiblioResolver
>
> Problem Overview: My goal is to publish an artifact using the UrlResolver
> and then retrieve it using the IBiblioResolver.  However, resolve fails if
> the dependency conf mapping is to something other than "->default".   What
> I observe is:
> 1- The ivy:resollve task succeeds if the UrlResolver is used for resolving
> as well as publishing.
> 2- The ivy:resolve task succeeds with the IBiblioResolver only if the conf
> mapping is to the "->default" for the published artifact.
> 3- When the dependency conf mapping is to something other than ->default,
> verbose logging indicates that "no ivy file file found for XXX: using
> default data"
> 4- When the "m2compitiblity" settings are the same for publish and
> resolve, the failure is always the same, regardless of its setting, and
> regardless of the "usepoms" setting.
>
> I have created a trivial example (below) that exhibits the behavior
> described above.
>
> Thanks for your help.
>
> === settings.properties ===
> pattern.artifacts.pub=[organization]/[module]/[
> revision]/[type]s/[artifact].[ext]
> pattern.ivy.pub=[organization]/[module]/[revision]/[type]s/[
> artifact].[ext]
>
> === settings.xml ===
> <ivysettings>
> <properties file="settings.properties" override="false" /> <settings
> defaultResolver="resolver-res" />
>
> <resolvers>
> <url name="resolver-pub" m2compatible="false" > <artifact
> pattern="${artifactory.url}/${rps.repo.integration}/${
> pattern.artifacts.pub}"
> />
> <ivy      pattern="${artifactory.url}/${rps.repo.integration}/${
> pattern.ivy.pub}"
> />
> </url>
> <ibiblio name="resolver-res" m2compatible="true" usepoms="false"
> root="${artifactory.url}/${rps.repo.integration}"
> pattern="${pattern.artifacts.pub}"
> />
> </resolvers>
> </ivysettings>
>
>
> === ivy.xml for Publish ===
> <ivy-module version="2.0">
> <info organisation="com.vcase.rps" module="pub"/>
>
> <configurations>
> <conf name="compile" visibility="private" /> <conf name="runtime"
> extends="compile"/> </configurations>
>
> <publications>
> <artifact/>
> </publications>
> </ivy-module>
>
> === ivy.xml for Resolving the published artifact === <ivy-module
> version="2.0"> <info organisation="com.vcase.rps" module="res"/>
>
> <configurations>
> <conf name="compile" visibility="private" /> <conf name="runtime"
> extends="compile"/> </configurations>
>
> <dependencies>
> <dependency org="com.vcase.rps" name="pub" rev="latest.integration"
> transitive="false" conf="compile->runtime" /> </dependencies> </ivy-module>
>
> === Build File ===
> <project name="delme" default="resolve" basedir="."
> xmlns:ivy="antlib:org.apache.ivy.ant" >
>
> <property environment="env" />
> <property file="settings.properties" />
>
> <property name="IvyJarFile"
> value="c:/dev/apache-ivy-2.4.0/build/artifact/jars/ivy.jar" /> <taskdef
> classpath="${IvyJarFile}"
> resource="org/apache/ivy/ant/antlib.xml"
> uri="antlib:org.apache.ivy.ant"
> />
>
> <target name="init" depends="clean" description="Initialize for the build"
> > <ivy:configure file="settings.xml"/> </target>
>
>
> <target name="publish" depends="init" description="Publish archives">
> <ivy:resolve file="ivy-pub.xml" /> <echo file="pub.jar"
> >file:pub.jar</echo> <ivy:publish artifactspattern="${basedir}/$
> {pattern.artifacts.built}"
> resolver="resolver-pub"
> pubrevision="1.0"
> forcedeliver="true"
> status="integration"
> overwrite="true"
> conf="compile,runtime"
> />
> </target>
>
>
> <target name="resolve" depends="init" >
> <ivy:resolve file="ivy-res.xml" type="jar" conf="*(public)" /> </target>
>
>
> <target  name="clean">
> <delete dir="c:/Users/vcase/.ivy2" includeemptydirs="true" verbose="true"
> /> <delete dir="c:/dev/devOpsProject/RpsApp/.ivy-internal-cache"
> includeemptydirs="true" />
> <delete dir="c:/dev/devOpsProject/RpsApp/.ivy-local-repo"
> includeemptydirs="true" />
> </target>
> </project>
>
>
>
> === Verbose Logging Output ====
>
> [ivy:resolve]           tried http://centos-7:8882/
> artifactory/rps-integration/com/vcase/rps/pub/[revision]/jars/pub.jar
> [ivy:resolve]   resolver-res: no ivy file found for
> com.vcase.rps#pub;latest.integration: using default data
> [ivy:resolve]           [1.0] com.vcase.rps#pub
> :
> :
> [ivy:resolve]           :: com.vcase.rps#pub;1.0: configuration not found
> in com.vcase.rps#pub;1.0: 'runtime'. It was required from
> com.vcase.rps#;working@vcase-PC-new compile
>
>
> EOM
>

AW: Issue Publishing with UrlResolver and later Resolving with IBiblioResolver

Posted by Geißler, Daniel <da...@salt-solutions.de>.
The ibiblio resolver is for dependency resolution in maven repositories. If you don't publish a pom.xml then resolving might be somewhat strange.

So you'll need to create a pom first: http://ant.apache.org/ivy/history/2.4.0/use/makepom.html where you can map your ivy configurations to maven scopes.
Add the pom to your publish section in the ivy.xml and try it again.

When resolving with the ibiblio resolver you are however bound to automatically created configurations that meet the maven scopes (master, compile, test ...). As far as I remember default is a combination of master (the artifact itself) and runtime (it's runtime dependencies).
 
When publishing with ivy.xml the url resolver should be sufficient and even faster than ibiblio.

Hope that helps.

Kind regards
Daniel

_____________________________________

www.salt-solutions.de

Geschäftsführer: Dr. Bernhard Blüthner, Norbert H. Fiedler, Dieter Heyde, Markus Honold
Sitz: München, AG München, HRB 146081 

-----Ursprüngliche Nachricht-----
Von: Vincent Case [mailto:vincent.case@gmail.com] 
Gesendet: Mi, 2. November 2016 18:36
An: ivy-user@ant.apache.org
Betreff: Issue Publishing with UrlResolver and later Resolving with IBiblioResolver

Problem Overview: My goal is to publish an artifact using the UrlResolver and then retrieve it using the IBiblioResolver.  However, resolve fails if
the dependency conf mapping is to something other than "->default".   What
I observe is:
1- The ivy:resollve task succeeds if the UrlResolver is used for resolving as well as publishing.
2- The ivy:resolve task succeeds with the IBiblioResolver only if the conf mapping is to the "->default" for the published artifact.
3- When the dependency conf mapping is to something other than ->default, verbose logging indicates that "no ivy file file found for XXX: using default data"
4- When the "m2compitiblity" settings are the same for publish and resolve, the failure is always the same, regardless of its setting, and regardless of the "usepoms" setting.

I have created a trivial example (below) that exhibits the behavior described above.

Thanks for your help.

=== settings.properties ===
pattern.artifacts.pub=[organization]/[module]/[revision]/[type]s/[artifact].[ext]
pattern.ivy.pub=[organization]/[module]/[revision]/[type]s/[artifact].[ext]

=== settings.xml ===
<ivysettings>
<properties file="settings.properties" override="false" /> <settings defaultResolver="resolver-res" />

<resolvers>
<url name="resolver-pub" m2compatible="false" > <artifact pattern="${artifactory.url}/${rps.repo.integration}/${pattern.artifacts.pub}"
/>
<ivy      pattern="${artifactory.url}/${rps.repo.integration}/${pattern.ivy.pub}"
/>
</url>
<ibiblio name="resolver-res" m2compatible="true" usepoms="false"
root="${artifactory.url}/${rps.repo.integration}"
pattern="${pattern.artifacts.pub}"
/>
</resolvers>
</ivysettings>


=== ivy.xml for Publish ===
<ivy-module version="2.0">
<info organisation="com.vcase.rps" module="pub"/>

<configurations>
<conf name="compile" visibility="private" /> <conf name="runtime" extends="compile"/> </configurations>

<publications>
<artifact/>
</publications>
</ivy-module>

=== ivy.xml for Resolving the published artifact === <ivy-module version="2.0"> <info organisation="com.vcase.rps" module="res"/>

<configurations>
<conf name="compile" visibility="private" /> <conf name="runtime" extends="compile"/> </configurations>

<dependencies>
<dependency org="com.vcase.rps" name="pub" rev="latest.integration"
transitive="false" conf="compile->runtime" /> </dependencies> </ivy-module>

=== Build File ===
<project name="delme" default="resolve" basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant" >

<property environment="env" />
<property file="settings.properties" />

<property name="IvyJarFile"
value="c:/dev/apache-ivy-2.4.0/build/artifact/jars/ivy.jar" /> <taskdef classpath="${IvyJarFile}"
resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant"
/>

<target name="init" depends="clean" description="Initialize for the build" > <ivy:configure file="settings.xml"/> </target>


<target name="publish" depends="init" description="Publish archives"> <ivy:resolve file="ivy-pub.xml" /> <echo file="pub.jar" >file:pub.jar</echo> <ivy:publish artifactspattern="${basedir}/${pattern.artifacts.built}"
resolver="resolver-pub"
pubrevision="1.0"
forcedeliver="true"
status="integration"
overwrite="true"
conf="compile,runtime"
/>
</target>


<target name="resolve" depends="init" >
<ivy:resolve file="ivy-res.xml" type="jar" conf="*(public)" /> </target>


<target  name="clean">
<delete dir="c:/Users/vcase/.ivy2" includeemptydirs="true" verbose="true" /> <delete dir="c:/dev/devOpsProject/RpsApp/.ivy-internal-cache"
includeemptydirs="true" />
<delete dir="c:/dev/devOpsProject/RpsApp/.ivy-local-repo"
includeemptydirs="true" />
</target>
</project>



=== Verbose Logging Output ====

[ivy:resolve]           tried http://centos-7:8882/
artifactory/rps-integration/com/vcase/rps/pub/[revision]/jars/pub.jar
[ivy:resolve]   resolver-res: no ivy file found for
com.vcase.rps#pub;latest.integration: using default data
[ivy:resolve]           [1.0] com.vcase.rps#pub
:
:
[ivy:resolve]           :: com.vcase.rps#pub;1.0: configuration not found
in com.vcase.rps#pub;1.0: 'runtime'. It was required from com.vcase.rps#;working@vcase-PC-new compile


EOM