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 Shaikh Almas <er...@gmail.com> on 2010/06/06 11:24:06 UTC
Issue with Ivy custome resolver
Hi,
Can anyone help me with creating custom ivy resolver. I wish to extend
URLResolver, such that it will have a new class say called ProxyURLResolver
where i will set the proxy, resolve the artifact and then remove the proxy
setting. I tried extending URLResolver directly before calling setRepository
method and reseting after and had typedef as well in ivysettings.xml, but it
didn't worked. Can you please help me by telling the exact steps that i need
to follow to create new cutom resolver?
Almas
Re: Issue with Ivy custome resolver
Posted by Geoff Clitheroe <g....@gmail.com>.
Are you trying to do something that you can't do with the existing Ant or
JVM proxy options? Check the FAQ and search for proxy
http://ant.apache.org/ivy/faq.html
Also http://ant.apache.org/manual/proxy.html
Cheers,
Geoff
On Sun, Jun 6, 2010 at 9:24 PM, Shaikh Almas <er...@gmail.com> wrote:
> Hi,
> Can anyone help me with creating custom ivy resolver. I wish to extend
> URLResolver, such that it will have a new class say called ProxyURLResolver
> where i will set the proxy, resolve the artifact and then remove the proxy
> setting. I tried extending URLResolver directly before calling
> setRepository
> method and reseting after and had typedef as well in ivysettings.xml, but
> it
> didn't worked. Can you please help me by telling the exact steps that i
> need
> to follow to create new cutom resolver?
>
> Almas
>
Re: Issue with Ivy custome resolver
Posted by Maarten Coene <ma...@yahoo.com>.
Issue #1:
you can do this with the Ant <proxy> task before you use Ivy in your ant build, something like this:
<setproxy proxyhost="yourproxy" proxyport="yourport" nonproxyhosts="www.internalCorporateRepo.org" />
More info about the setproxy task: http://ant.apache.org/manual/Tasks/setproxy.html
Issue #2:
I'm not sure it will work, but perhaps you can solve it by having 2 artifact patterns: 1 with a revision, another without a revision?
<url name="privateRepo" m2compatible="true">
<artifact
pattern="http://www.localrepo.com/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
<artifact
pattern="http://www.localrepo.com/maven2/[organisation]/[module]/[artifact].[ext]"/>
</url>
Issue #3:
So I think if you specify the axis2 version in axis2/ivy/ivy.xml it should solve your issue.
Maarten
----- Original Message ----
From: Shaikh Almas <er...@gmail.com>
To: ivy-user@ant.apache.org
Sent: Wed, June 9, 2010 6:18:20 PM
Subject: Re: Issue with Ivy custome resolver
Here are the answers Maarten:
Issue #1:
Can you please help me to understand how should i set reset system property
using Ivy (i.e. how can i set proxy when i want to go to external repo and
how can i reset proxy when i need to access internal repo)?
Issue #2:
I tried using following in ivysettings.xml
<url name="privateRepo" m2compatible="true"> <artifact pattern="
http://www.localrepo.com/maven2/[organisation]/[module]/[revision]/[artifact](-[revision]).[ext]
"/></url>
and below in ivy.xml
<dependency org="pqr" name="xyz" rev=""/>
but ivy tries to resolve it as
http://www.localrepo.com/maven2/pqr/xyz//xyz-.jar"/<http://www.localrepo.com/maven2/pqr/xyz//xyz-.jar%22/>
Note the Hyphen remains as is. Is there a way i can make "-" also optional?
Issue #3:
No i didnt specify any revision for commons-lang.
Thanks Issue #5 is resolved using svn resolver.
Thanks,
Almas
On Wed, Jun 9, 2010 at 2:17 AM, Maarten Coene <ma...@yahoo.com>wrote:
> A quick attempt to answer your questions.
>
> Issue #1:
> It won't work since the proxy handling is done dynamically: everytime a
> resource is downloaded. So setting/resetting the proxy in the constructor
> won't do anything since nothing is downloaded there...
> But I think you want to avoid Ivy to use a proxy for your private
> repository. Right? Although I didn't test it, I think you can use the system
> property http.nonProxyHosts for this (if you don't have commons-httpclient
> in Ivy's classpath).
>
>
> Issue #2:
> Could you try setting the rev attribute to an empty string instead of
> 'latest.integration' for those dependencies without revision?
>
> Issue #3:
> It seems to me that Ivy thinks that 'working@commons-lang' is the revision
> of your axis dependency. Did you specify a revision in the axis2/ivy/ivy.xml
> of your "commons-lang" repository?
>
> Issue #4 and #6:
> I don't have any idea. Anyone else around here who can answer this
> packager-resolver question?
>
>
> Issue #5:
> Ivy hasn't built-in support for publishing artifacts into SVN. But there is
> an SVN resolver available (check the links on the website) which I think
> support SVN publishing.
>
> regards,
> Maarten
>
>
>
>
> ----- Original Message ----
> From: Shaikh Almas <er...@gmail.com>
> To: ivy-user@ant.apache.org
> Sent: Tue, June 8, 2010 6:34:26 PM
> Subject: Re: Issue with Ivy custome resolver
>
> Hi Maarten,
>
> For below mentioned issue, here is the ivysettings.xml (Issue #1 is given
> in
> my below mail and ivysettings.xml is for the same)
>
> *Issue #1*
> <ivysettings>
> <settings defaultResolver="chained" defaultConflictManager="all" />
> <typedef name="almas" classname="com.xyz.ivy.ProxyUrlResolver"/>
> <resolvers>
> <almas name="privateRepo" m2compatible="true">
> <artifact pattern="
>
> http://www.ibiblio.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]
> "/<
> http://www.ibiblio.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]%22/
> >
> >
> </almas>
> <url name="private">
> <artifact pattern="
>
> http://www.internalCorporateRepo.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]<http://www.internalcorporaterepo.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]>
> "/<
> http://www.internalcorporaterepo.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]%22/
> >
> >
> </url>
> <!-- Order in which the dependency would be resolved -->
> <chain name="chained" returnFirst="true">
> <resolver ref="privateRepo" />
> <resolver ref="private" />
> </chain>
> </resolvers>
> </ivysettings>
> And here's the code for ProxyUrlResolver
> package com.xyz.ivy;
> import org.apache.ivy.plugins.repository.url.URLRepository;
> import org.apache.ivy.plugins.resolver.URLResolver;
> import org.apache.ivy.util.Message;
> public class ProxyUrlResolver extends URLResolver{
> private void setProxy(){
> System.setProperty("http.proxyHost", System.getProperty("proxyHost", "
> proxy.xxxxxxx.net"));
> System.setProperty("http.proxyPort", System.getProperty("proxyPort",
> "8443"));
> }
> public ProxyUrlResolver(){
> Message.verbose("About to set the proxy");
> setProxy();
> setRepository(new URLRepository());
> Message.verbose("About to reset the proxy");
> resetProxy();
> }
>
> private void resetProxy(){
> System.setProperty("http.proxyHost", null);
> System.setProperty("http.proxyPort", null);
> }
> }
> I know that this is the wrong way. Can you please help me to get the
> correct
> way out of it please?
>
> *Issue#2*
>
> I have certain jar files without revision number. But as rev is mandatory
> attribute for ivy dependency, i am providing the revision attribute. But i
> have something like (-[revision]) in url resolver. but its taking the
> module
> number instead of ignoring the revision attribute. I know it wont ignore
> the
> revision attribute as its not null.
> Following is the output that i get
> default-cache: no cached resolved revision for
> perltools#perltools;latest.integration [ivy:retrieve] tried [ivy:retrieve]
> listing all in [ivy:retrieve] using privateRepo to list all in
> [ivy:retrieve] ApacheURLLister found URL=[
> httP://myrepo/ivyRepository/perltools/jars/perltools.jar<http://myrepo/ivyRepository/perltools/jars/perltools.jar>].
> [ivy:retrieve]
> found 1 resources [ivy:retrieve] found revs: [perltools.jar] [ivy:retrieve]
> HTTP response status: 404 url=
>
> httP://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar[ivy:retrieve]<http://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar[ivy:retrieve]>
> CLIENT ERROR: Not Found url=
>
> httP://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar<http://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar>
> Can somebody please explain why its taking module.ext as revision where
> revision i specified is latest.integration and in myrepo, i dont have
> revision attribute. its just has
> [http://myrepo/ivyRepository/perltools/jars//perltools.jar]
> Can somebody please help me so that i can avoid revision attribute?
>
> *Issue #3*
>
> I ma using dual resolver and having a problem.
> Following is what i get when i run through ant in debug and verbose mode([
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ])
> [ivy:retrieve] resolved ivy file produced in
> c:\temp\ivy\resolved-stratus-stratus-working@WPRMW07536F4BS.xml
> [ivy:retrieve]
> :: downloading artifacts :: [ivy:retrieve] [NOT REQUIRED]
> config#ego;4.3.1!ego.conf [ivy:retrieve] trying [
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ]
> [ivy:retrieve] tried [
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ]
> [ivy:retrieve] HTTP response status: 404 url=[
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ]
> [ivy:retrieve] CLIENT ERROR: Not Found url=[
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ]
> [ivy:retrieve] ibiblio: resource not reachable for
> axis2#axis2;working@commons-lang: res=[
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ]
> [ivy:retrieve] WARN: [NOT FOUND ] axis2#axis2;working@commons-lang
> !axis2.jar
> (235ms) [ivy:retrieve] WARN: ==== commons-lang: tried [ivy:retrieve] WARN:
> ==== ibiblio: tried [ivy:retrieve] WARN: [
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ]
> [ivy:retrieve] [NOT REQUIRED] axis#axis-saaj;1.4!axis-saaj.jar
> [ivy:retrieve] [NOT REQUIRED] axis#axis-wsdl4j;1.5.1!axis-wsdl4j.jar
> Can you please tell me what is wrong with my ivysetting file or wrong with
> ivy file?
> Following is excerpt from ivysettings.xml
> <dual name="dual4">
> <filesystem name="commons-lang">
> <ivy pattern="${localRepositoryLocation}/[module]/ivy/ivy.xml"/>
> </filesystem>
> <ibiblio name="ibiblio" m2compatible="true" usepoms="false" /> </dual>
> The problem (may be) is for each and every dependancy that i defined i have
> seperate ivy.xml. and just one reolver as above? like just for an exampe,
> for axis2.jar i have two dependancies in another ivy.xml, the dependencies
> are axis-saaj and axis-wsdl4j.
> Please help
>
> *Issue #4*
>
> I am using packager resolver and that packager resolver resolves the zip
> file, unzip it, extracts the jar file from it in temp build file, but it
> stays temporarily and only the jar file which i specified as a module name
> gets copied to destination rest of all are ignored. Is there a way i can
> get
> all the jar files? I use preseverBuildDirectories but is there a better way
> to do it?
>
> *Issue #5*
> Also is it possible for me to publish an artifact to svn using normal ivy?
> I
> got error while i was trying to use ivy 2.1.0 on XP using ant 1.8.0
> java.illegalArguementException saying authorization failed. Is there a way
> i
> can work through ivy:publish?
>
> *Issue #6*
>
> Is there a way i can use ivy variable in packager.xml?
>
> Please help.
>
> Thanks,
> Almas
> On Mon, Jun 7, 2010 at 2:27 AM, Maarten Coene <maarten_coene@yahoo.com
> >wrote:
>
> > Can you post your settings.xml so we can see what you already have done?
> >
> > Maarten
> >
> >
> >
> > ----- Original Message ----
> > From: Shaikh Almas <er...@gmail.com>
> > To: ivy-user@ant.apache.org
> > Sent: Sun, June 6, 2010 11:24:06 AM
> > Subject: Issue with Ivy custome resolver
> >
> > Hi,
> > Can anyone help me with creating custom ivy resolver. I wish to extend
> > URLResolver, such that it will have a new class say called
> ProxyURLResolver
> > where i will set the proxy, resolve the artifact and then remove the
> proxy
> > setting. I tried extending URLResolver directly before calling
> > setRepository
> > method and reseting after and had typedef as well in ivysettings.xml, but
> > it
> > didn't worked. Can you please help me by telling the exact steps that i
> > need
> > to follow to create new cutom resolver?
> >
> > Almas
> >
> >
> >
> >
> >
>
>
>
>
>
Re: Issue with Ivy custome resolver
Posted by Shaikh Almas <er...@gmail.com>.
Here are the answers Maarten:
Issue #1:
Can you please help me to understand how should i set reset system property
using Ivy (i.e. how can i set proxy when i want to go to external repo and
how can i reset proxy when i need to access internal repo)?
Issue #2:
I tried using following in ivysettings.xml
<url name="privateRepo" m2compatible="true"> <artifact pattern="
http://www.localrepo.com/maven2/[organisation]/[module]/[revision]/[artifact](-[revision]).[ext]
"/></url>
and below in ivy.xml
<dependency org="pqr" name="xyz" rev=""/>
but ivy tries to resolve it as
http://www.localrepo.com/maven2/pqr/xyz//xyz-.jar"/<http://www.localrepo.com/maven2/pqr/xyz//xyz-.jar%22/>
Note the Hyphen remains as is. Is there a way i can make "-" also optional?
Issue #3:
No i didnt specify any revision for commons-lang.
Thanks Issue #5 is resolved using svn resolver.
Thanks,
Almas
On Wed, Jun 9, 2010 at 2:17 AM, Maarten Coene <ma...@yahoo.com>wrote:
> A quick attempt to answer your questions.
>
> Issue #1:
> It won't work since the proxy handling is done dynamically: everytime a
> resource is downloaded. So setting/resetting the proxy in the constructor
> won't do anything since nothing is downloaded there...
> But I think you want to avoid Ivy to use a proxy for your private
> repository. Right? Although I didn't test it, I think you can use the system
> property http.nonProxyHosts for this (if you don't have commons-httpclient
> in Ivy's classpath).
>
>
> Issue #2:
> Could you try setting the rev attribute to an empty string instead of
> 'latest.integration' for those dependencies without revision?
>
> Issue #3:
> It seems to me that Ivy thinks that 'working@commons-lang' is the revision
> of your axis dependency. Did you specify a revision in the axis2/ivy/ivy.xml
> of your "commons-lang" repository?
>
> Issue #4 and #6:
> I don't have any idea. Anyone else around here who can answer this
> packager-resolver question?
>
>
> Issue #5:
> Ivy hasn't built-in support for publishing artifacts into SVN. But there is
> an SVN resolver available (check the links on the website) which I think
> support SVN publishing.
>
> regards,
> Maarten
>
>
>
>
> ----- Original Message ----
> From: Shaikh Almas <er...@gmail.com>
> To: ivy-user@ant.apache.org
> Sent: Tue, June 8, 2010 6:34:26 PM
> Subject: Re: Issue with Ivy custome resolver
>
> Hi Maarten,
>
> For below mentioned issue, here is the ivysettings.xml (Issue #1 is given
> in
> my below mail and ivysettings.xml is for the same)
>
> *Issue #1*
> <ivysettings>
> <settings defaultResolver="chained" defaultConflictManager="all" />
> <typedef name="almas" classname="com.xyz.ivy.ProxyUrlResolver"/>
> <resolvers>
> <almas name="privateRepo" m2compatible="true">
> <artifact pattern="
>
> http://www.ibiblio.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]
> "/<
> http://www.ibiblio.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]%22/
> >
> >
> </almas>
> <url name="private">
> <artifact pattern="
>
> http://www.internalCorporateRepo.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]<http://www.internalcorporaterepo.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]>
> "/<
> http://www.internalcorporaterepo.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]%22/
> >
> >
> </url>
> <!-- Order in which the dependency would be resolved -->
> <chain name="chained" returnFirst="true">
> <resolver ref="privateRepo" />
> <resolver ref="private" />
> </chain>
> </resolvers>
> </ivysettings>
> And here's the code for ProxyUrlResolver
> package com.xyz.ivy;
> import org.apache.ivy.plugins.repository.url.URLRepository;
> import org.apache.ivy.plugins.resolver.URLResolver;
> import org.apache.ivy.util.Message;
> public class ProxyUrlResolver extends URLResolver{
> private void setProxy(){
> System.setProperty("http.proxyHost", System.getProperty("proxyHost", "
> proxy.xxxxxxx.net"));
> System.setProperty("http.proxyPort", System.getProperty("proxyPort",
> "8443"));
> }
> public ProxyUrlResolver(){
> Message.verbose("About to set the proxy");
> setProxy();
> setRepository(new URLRepository());
> Message.verbose("About to reset the proxy");
> resetProxy();
> }
>
> private void resetProxy(){
> System.setProperty("http.proxyHost", null);
> System.setProperty("http.proxyPort", null);
> }
> }
> I know that this is the wrong way. Can you please help me to get the
> correct
> way out of it please?
>
> *Issue#2*
>
> I have certain jar files without revision number. But as rev is mandatory
> attribute for ivy dependency, i am providing the revision attribute. But i
> have something like (-[revision]) in url resolver. but its taking the
> module
> number instead of ignoring the revision attribute. I know it wont ignore
> the
> revision attribute as its not null.
> Following is the output that i get
> default-cache: no cached resolved revision for
> perltools#perltools;latest.integration [ivy:retrieve] tried [ivy:retrieve]
> listing all in [ivy:retrieve] using privateRepo to list all in
> [ivy:retrieve] ApacheURLLister found URL=[
> httP://myrepo/ivyRepository/perltools/jars/perltools.jar<http://myrepo/ivyRepository/perltools/jars/perltools.jar>].
> [ivy:retrieve]
> found 1 resources [ivy:retrieve] found revs: [perltools.jar] [ivy:retrieve]
> HTTP response status: 404 url=
>
> httP://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar[ivy:retrieve]<http://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar[ivy:retrieve]>
> CLIENT ERROR: Not Found url=
>
> httP://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar<http://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar>
> Can somebody please explain why its taking module.ext as revision where
> revision i specified is latest.integration and in myrepo, i dont have
> revision attribute. its just has
> [http://myrepo/ivyRepository/perltools/jars//perltools.jar]
> Can somebody please help me so that i can avoid revision attribute?
>
> *Issue #3*
>
> I ma using dual resolver and having a problem.
> Following is what i get when i run through ant in debug and verbose mode([
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ])
> [ivy:retrieve] resolved ivy file produced in
> c:\temp\ivy\resolved-stratus-stratus-working@WPRMW07536F4BS.xml
> [ivy:retrieve]
> :: downloading artifacts :: [ivy:retrieve] [NOT REQUIRED]
> config#ego;4.3.1!ego.conf [ivy:retrieve] trying [
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ]
> [ivy:retrieve] tried [
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ]
> [ivy:retrieve] HTTP response status: 404 url=[
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ]
> [ivy:retrieve] CLIENT ERROR: Not Found url=[
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ]
> [ivy:retrieve] ibiblio: resource not reachable for
> axis2#axis2;working@commons-lang: res=[
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ]
> [ivy:retrieve] WARN: [NOT FOUND ] axis2#axis2;working@commons-lang
> !axis2.jar
> (235ms) [ivy:retrieve] WARN: ==== commons-lang: tried [ivy:retrieve] WARN:
> ==== ibiblio: tried [ivy:retrieve] WARN: [
>
> http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
> ]
> [ivy:retrieve] [NOT REQUIRED] axis#axis-saaj;1.4!axis-saaj.jar
> [ivy:retrieve] [NOT REQUIRED] axis#axis-wsdl4j;1.5.1!axis-wsdl4j.jar
> Can you please tell me what is wrong with my ivysetting file or wrong with
> ivy file?
> Following is excerpt from ivysettings.xml
> <dual name="dual4">
> <filesystem name="commons-lang">
> <ivy pattern="${localRepositoryLocation}/[module]/ivy/ivy.xml"/>
> </filesystem>
> <ibiblio name="ibiblio" m2compatible="true" usepoms="false" /> </dual>
> The problem (may be) is for each and every dependancy that i defined i have
> seperate ivy.xml. and just one reolver as above? like just for an exampe,
> for axis2.jar i have two dependancies in another ivy.xml, the dependencies
> are axis-saaj and axis-wsdl4j.
> Please help
>
> *Issue #4*
>
> I am using packager resolver and that packager resolver resolves the zip
> file, unzip it, extracts the jar file from it in temp build file, but it
> stays temporarily and only the jar file which i specified as a module name
> gets copied to destination rest of all are ignored. Is there a way i can
> get
> all the jar files? I use preseverBuildDirectories but is there a better way
> to do it?
>
> *Issue #5*
> Also is it possible for me to publish an artifact to svn using normal ivy?
> I
> got error while i was trying to use ivy 2.1.0 on XP using ant 1.8.0
> java.illegalArguementException saying authorization failed. Is there a way
> i
> can work through ivy:publish?
>
> *Issue #6*
>
> Is there a way i can use ivy variable in packager.xml?
>
> Please help.
>
> Thanks,
> Almas
> On Mon, Jun 7, 2010 at 2:27 AM, Maarten Coene <maarten_coene@yahoo.com
> >wrote:
>
> > Can you post your settings.xml so we can see what you already have done?
> >
> > Maarten
> >
> >
> >
> > ----- Original Message ----
> > From: Shaikh Almas <er...@gmail.com>
> > To: ivy-user@ant.apache.org
> > Sent: Sun, June 6, 2010 11:24:06 AM
> > Subject: Issue with Ivy custome resolver
> >
> > Hi,
> > Can anyone help me with creating custom ivy resolver. I wish to extend
> > URLResolver, such that it will have a new class say called
> ProxyURLResolver
> > where i will set the proxy, resolve the artifact and then remove the
> proxy
> > setting. I tried extending URLResolver directly before calling
> > setRepository
> > method and reseting after and had typedef as well in ivysettings.xml, but
> > it
> > didn't worked. Can you please help me by telling the exact steps that i
> > need
> > to follow to create new cutom resolver?
> >
> > Almas
> >
> >
> >
> >
> >
>
>
>
>
>
Re: Issue with Ivy custome resolver
Posted by Maarten Coene <ma...@yahoo.com>.
A quick attempt to answer your questions.
Issue #1:
It won't work since the proxy handling is done dynamically: everytime a resource is downloaded. So setting/resetting the proxy in the constructor won't do anything since nothing is downloaded there...
But I think you want to avoid Ivy to use a proxy for your private repository. Right? Although I didn't test it, I think you can use the system property http.nonProxyHosts for this (if you don't have commons-httpclient in Ivy's classpath).
Issue #2:
Could you try setting the rev attribute to an empty string instead of 'latest.integration' for those dependencies without revision?
Issue #3:
It seems to me that Ivy thinks that 'working@commons-lang' is the revision of your axis dependency. Did you specify a revision in the axis2/ivy/ivy.xml of your "commons-lang" repository?
Issue #4 and #6:
I don't have any idea. Anyone else around here who can answer this packager-resolver question?
Issue #5:
Ivy hasn't built-in support for publishing artifacts into SVN. But there is an SVN resolver available (check the links on the website) which I think support SVN publishing.
regards,
Maarten
----- Original Message ----
From: Shaikh Almas <er...@gmail.com>
To: ivy-user@ant.apache.org
Sent: Tue, June 8, 2010 6:34:26 PM
Subject: Re: Issue with Ivy custome resolver
Hi Maarten,
For below mentioned issue, here is the ivysettings.xml (Issue #1 is given in
my below mail and ivysettings.xml is for the same)
*Issue #1*
<ivysettings>
<settings defaultResolver="chained" defaultConflictManager="all" />
<typedef name="almas" classname="com.xyz.ivy.ProxyUrlResolver"/>
<resolvers>
<almas name="privateRepo" m2compatible="true">
<artifact pattern="
http://www.ibiblio.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/<http://www.ibiblio.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]%22/>
>
</almas>
<url name="private">
<artifact pattern="
http://www.internalCorporateRepo.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/<http://www.internalcorporaterepo.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]%22/>
>
</url>
<!-- Order in which the dependency would be resolved -->
<chain name="chained" returnFirst="true">
<resolver ref="privateRepo" />
<resolver ref="private" />
</chain>
</resolvers>
</ivysettings>
And here's the code for ProxyUrlResolver
package com.xyz.ivy;
import org.apache.ivy.plugins.repository.url.URLRepository;
import org.apache.ivy.plugins.resolver.URLResolver;
import org.apache.ivy.util.Message;
public class ProxyUrlResolver extends URLResolver{
private void setProxy(){
System.setProperty("http.proxyHost", System.getProperty("proxyHost", "
proxy.xxxxxxx.net"));
System.setProperty("http.proxyPort", System.getProperty("proxyPort",
"8443"));
}
public ProxyUrlResolver(){
Message.verbose("About to set the proxy");
setProxy();
setRepository(new URLRepository());
Message.verbose("About to reset the proxy");
resetProxy();
}
private void resetProxy(){
System.setProperty("http.proxyHost", null);
System.setProperty("http.proxyPort", null);
}
}
I know that this is the wrong way. Can you please help me to get the correct
way out of it please?
*Issue#2*
I have certain jar files without revision number. But as rev is mandatory
attribute for ivy dependency, i am providing the revision attribute. But i
have something like (-[revision]) in url resolver. but its taking the module
number instead of ignoring the revision attribute. I know it wont ignore the
revision attribute as its not null.
Following is the output that i get
default-cache: no cached resolved revision for
perltools#perltools;latest.integration [ivy:retrieve] tried [ivy:retrieve]
listing all in [ivy:retrieve] using privateRepo to list all in
[ivy:retrieve] ApacheURLLister found URL=[
httP://myrepo/ivyRepository/perltools/jars/perltools.jar]. [ivy:retrieve]
found 1 resources [ivy:retrieve] found revs: [perltools.jar] [ivy:retrieve]
HTTP response status: 404 url=
httP://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar[ivy:retrieve]
CLIENT ERROR: Not Found url=
httP://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar
Can somebody please explain why its taking module.ext as revision where
revision i specified is latest.integration and in myrepo, i dont have
revision attribute. its just has
[http://myrepo/ivyRepository/perltools/jars//perltools.jar]
Can somebody please help me so that i can avoid revision attribute?
*Issue #3*
I ma using dual resolver and having a problem.
Following is what i get when i run through ant in debug and verbose mode([
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
])
[ivy:retrieve] resolved ivy file produced in
c:\temp\ivy\resolved-stratus-stratus-working@WPRMW07536F4BS.xml[ivy:retrieve]
:: downloading artifacts :: [ivy:retrieve] [NOT REQUIRED]
config#ego;4.3.1!ego.conf [ivy:retrieve] trying [
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar]
[ivy:retrieve] tried [
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar]
[ivy:retrieve] HTTP response status: 404 url=[
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar]
[ivy:retrieve] CLIENT ERROR: Not Found url=[
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar]
[ivy:retrieve] ibiblio: resource not reachable for
axis2#axis2;working@commons-lang: res=[
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar]
[ivy:retrieve] WARN: [NOT FOUND ] axis2#axis2;working@commons-lang!axis2.jar
(235ms) [ivy:retrieve] WARN: ==== commons-lang: tried [ivy:retrieve] WARN:
==== ibiblio: tried [ivy:retrieve] WARN: [
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar]
[ivy:retrieve] [NOT REQUIRED] axis#axis-saaj;1.4!axis-saaj.jar
[ivy:retrieve] [NOT REQUIRED] axis#axis-wsdl4j;1.5.1!axis-wsdl4j.jar
Can you please tell me what is wrong with my ivysetting file or wrong with
ivy file?
Following is excerpt from ivysettings.xml
<dual name="dual4">
<filesystem name="commons-lang">
<ivy pattern="${localRepositoryLocation}/[module]/ivy/ivy.xml"/>
</filesystem>
<ibiblio name="ibiblio" m2compatible="true" usepoms="false" /> </dual>
The problem (may be) is for each and every dependancy that i defined i have
seperate ivy.xml. and just one reolver as above? like just for an exampe,
for axis2.jar i have two dependancies in another ivy.xml, the dependencies
are axis-saaj and axis-wsdl4j.
Please help
*Issue #4*
I am using packager resolver and that packager resolver resolves the zip
file, unzip it, extracts the jar file from it in temp build file, but it
stays temporarily and only the jar file which i specified as a module name
gets copied to destination rest of all are ignored. Is there a way i can get
all the jar files? I use preseverBuildDirectories but is there a better way
to do it?
*Issue #5*
Also is it possible for me to publish an artifact to svn using normal ivy? I
got error while i was trying to use ivy 2.1.0 on XP using ant 1.8.0
java.illegalArguementException saying authorization failed. Is there a way i
can work through ivy:publish?
*Issue #6*
Is there a way i can use ivy variable in packager.xml?
Please help.
Thanks,
Almas
On Mon, Jun 7, 2010 at 2:27 AM, Maarten Coene <ma...@yahoo.com>wrote:
> Can you post your settings.xml so we can see what you already have done?
>
> Maarten
>
>
>
> ----- Original Message ----
> From: Shaikh Almas <er...@gmail.com>
> To: ivy-user@ant.apache.org
> Sent: Sun, June 6, 2010 11:24:06 AM
> Subject: Issue with Ivy custome resolver
>
> Hi,
> Can anyone help me with creating custom ivy resolver. I wish to extend
> URLResolver, such that it will have a new class say called ProxyURLResolver
> where i will set the proxy, resolve the artifact and then remove the proxy
> setting. I tried extending URLResolver directly before calling
> setRepository
> method and reseting after and had typedef as well in ivysettings.xml, but
> it
> didn't worked. Can you please help me by telling the exact steps that i
> need
> to follow to create new cutom resolver?
>
> Almas
>
>
>
>
>
Re: Issue with Ivy custome resolver
Posted by Shaikh Almas <er...@gmail.com>.
Hi Archie,
For issue #6, I just need some of the variables that either i defined in
ivy.properties in ivysettings.xml or build.properties in ant.
Thanks,
Almas
On Wed, Jun 9, 2010 at 3:09 AM, Archie Cobbs <ar...@dellroad.org> wrote:
> On Tue, Jun 8, 2010 at 11:34 AM, Shaikh Almas <er...@gmail.com> wrote:
>
> > *Issue #4*
> >
> > I am using packager resolver and that packager resolver resolves the zip
> > file, unzip it, extracts the jar file from it in temp build file, but it
> > stays temporarily and only the jar file which i specified as a module
> name
> > gets copied to destination rest of all are ignored. Is there a way i can
> > get
> > all the jar files? I use preseverBuildDirectories but is there a better
> way
> > to do it?
> >
>
> Which JAR files you get is a function of the configuration(s) specified in
> your dependency and the ivy.xml of the module you're depending on (as well
> as nested <artifact> tags, etc.). There is nothing
> packager-resolver-specific about this; all resolvers work this way.
>
> Unfortunately, there is no facility to "talk directly" to the packager
> resolver to ask it for special favors :-)
>
> Perhaps the module you are depending on doesn't publish all of the JARs you
> need? If that's the case then contact the author of that module.
>
>
> > *Issue #6*
> >
> > Is there a way i can use ivy variable in packager.xml?
> >
>
> Doing this would imply some kind of implicit contract between the creator
> of
> the repository and all its users... so presumably you are using a private
> repository? What goal are you trying to accomplish? (I'm just curious)
>
> To answer your question, I'm not actually sure what will happen... my
> recollection is that ant properties are not passed down through to the
> packager.xml level (this is to keep the packager build "pure"). if it
> doesn't work when you try it, then you can assume it doesn't work.
>
> -Archie
>
> --
> Archie L. Cobbs
>
Re: Issue with Ivy custome resolver
Posted by Archie Cobbs <ar...@dellroad.org>.
On Tue, Jun 8, 2010 at 11:34 AM, Shaikh Almas <er...@gmail.com> wrote:
> *Issue #4*
>
> I am using packager resolver and that packager resolver resolves the zip
> file, unzip it, extracts the jar file from it in temp build file, but it
> stays temporarily and only the jar file which i specified as a module name
> gets copied to destination rest of all are ignored. Is there a way i can
> get
> all the jar files? I use preseverBuildDirectories but is there a better way
> to do it?
>
Which JAR files you get is a function of the configuration(s) specified in
your dependency and the ivy.xml of the module you're depending on (as well
as nested <artifact> tags, etc.). There is nothing
packager-resolver-specific about this; all resolvers work this way.
Unfortunately, there is no facility to "talk directly" to the packager
resolver to ask it for special favors :-)
Perhaps the module you are depending on doesn't publish all of the JARs you
need? If that's the case then contact the author of that module.
> *Issue #6*
>
> Is there a way i can use ivy variable in packager.xml?
>
Doing this would imply some kind of implicit contract between the creator of
the repository and all its users... so presumably you are using a private
repository? What goal are you trying to accomplish? (I'm just curious)
To answer your question, I'm not actually sure what will happen... my
recollection is that ant properties are not passed down through to the
packager.xml level (this is to keep the packager build "pure"). if it
doesn't work when you try it, then you can assume it doesn't work.
-Archie
--
Archie L. Cobbs
Re: Issue with Ivy custome resolver
Posted by Shaikh Almas <er...@gmail.com>.
Hi Maarten,
For below mentioned issue, here is the ivysettings.xml (Issue #1 is given in
my below mail and ivysettings.xml is for the same)
*Issue #1*
<ivysettings>
<settings defaultResolver="chained" defaultConflictManager="all" />
<typedef name="almas" classname="com.xyz.ivy.ProxyUrlResolver"/>
<resolvers>
<almas name="privateRepo" m2compatible="true">
<artifact pattern="
http://www.ibiblio.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/<http://www.ibiblio.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]%22/>
>
</almas>
<url name="private">
<artifact pattern="
http://www.internalCorporateRepo.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/<http://www.internalcorporaterepo.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]%22/>
>
</url>
<!-- Order in which the dependency would be resolved -->
<chain name="chained" returnFirst="true">
<resolver ref="privateRepo" />
<resolver ref="private" />
</chain>
</resolvers>
</ivysettings>
And here's the code for ProxyUrlResolver
package com.xyz.ivy;
import org.apache.ivy.plugins.repository.url.URLRepository;
import org.apache.ivy.plugins.resolver.URLResolver;
import org.apache.ivy.util.Message;
public class ProxyUrlResolver extends URLResolver{
private void setProxy(){
System.setProperty("http.proxyHost", System.getProperty("proxyHost", "
proxy.xxxxxxx.net"));
System.setProperty("http.proxyPort", System.getProperty("proxyPort",
"8443"));
}
public ProxyUrlResolver(){
Message.verbose("About to set the proxy");
setProxy();
setRepository(new URLRepository());
Message.verbose("About to reset the proxy");
resetProxy();
}
private void resetProxy(){
System.setProperty("http.proxyHost", null);
System.setProperty("http.proxyPort", null);
}
}
I know that this is the wrong way. Can you please help me to get the correct
way out of it please?
*Issue#2*
I have certain jar files without revision number. But as rev is mandatory
attribute for ivy dependency, i am providing the revision attribute. But i
have something like (-[revision]) in url resolver. but its taking the module
number instead of ignoring the revision attribute. I know it wont ignore the
revision attribute as its not null.
Following is the output that i get
default-cache: no cached resolved revision for
perltools#perltools;latest.integration [ivy:retrieve] tried [ivy:retrieve]
listing all in [ivy:retrieve] using privateRepo to list all in
[ivy:retrieve] ApacheURLLister found URL=[
httP://myrepo/ivyRepository/perltools/jars/perltools.jar]. [ivy:retrieve]
found 1 resources [ivy:retrieve] found revs: [perltools.jar] [ivy:retrieve]
HTTP response status: 404 url=
httP://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar[ivy:retrieve]
CLIENT ERROR: Not Found url=
httP://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar
Can somebody please explain why its taking module.ext as revision where
revision i specified is latest.integration and in myrepo, i dont have
revision attribute. its just has
[http://myrepo/ivyRepository/perltools/jars//perltools.jar]
Can somebody please help me so that i can avoid revision attribute?
*Issue #3*
I ma using dual resolver and having a problem.
Following is what i get when i run through ant in debug and verbose mode([
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar
])
[ivy:retrieve] resolved ivy file produced in
c:\temp\ivy\resolved-stratus-stratus-working@WPRMW07536F4BS.xml[ivy:retrieve]
:: downloading artifacts :: [ivy:retrieve] [NOT REQUIRED]
config#ego;4.3.1!ego.conf [ivy:retrieve] trying [
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar]
[ivy:retrieve] tried [
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar]
[ivy:retrieve] HTTP response status: 404 url=[
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar]
[ivy:retrieve] CLIENT ERROR: Not Found url=[
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar]
[ivy:retrieve] ibiblio: resource not reachable for
axis2#axis2;working@commons-lang: res=[
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar]
[ivy:retrieve] WARN: [NOT FOUND ] axis2#axis2;working@commons-lang!axis2.jar
(235ms) [ivy:retrieve] WARN: ==== commons-lang: tried [ivy:retrieve] WARN:
==== ibiblio: tried [ivy:retrieve] WARN: [
http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/axis2-working@commons-lang.jar]
[ivy:retrieve] [NOT REQUIRED] axis#axis-saaj;1.4!axis-saaj.jar
[ivy:retrieve] [NOT REQUIRED] axis#axis-wsdl4j;1.5.1!axis-wsdl4j.jar
Can you please tell me what is wrong with my ivysetting file or wrong with
ivy file?
Following is excerpt from ivysettings.xml
<dual name="dual4">
<filesystem name="commons-lang">
<ivy pattern="${localRepositoryLocation}/[module]/ivy/ivy.xml"/>
</filesystem>
<ibiblio name="ibiblio" m2compatible="true" usepoms="false" /> </dual>
The problem (may be) is for each and every dependancy that i defined i have
seperate ivy.xml. and just one reolver as above? like just for an exampe,
for axis2.jar i have two dependancies in another ivy.xml, the dependencies
are axis-saaj and axis-wsdl4j.
Please help
*Issue #4*
I am using packager resolver and that packager resolver resolves the zip
file, unzip it, extracts the jar file from it in temp build file, but it
stays temporarily and only the jar file which i specified as a module name
gets copied to destination rest of all are ignored. Is there a way i can get
all the jar files? I use preseverBuildDirectories but is there a better way
to do it?
*Issue #5*
Also is it possible for me to publish an artifact to svn using normal ivy? I
got error while i was trying to use ivy 2.1.0 on XP using ant 1.8.0
java.illegalArguementException saying authorization failed. Is there a way i
can work through ivy:publish?
*Issue #6*
Is there a way i can use ivy variable in packager.xml?
Please help.
Thanks,
Almas
On Mon, Jun 7, 2010 at 2:27 AM, Maarten Coene <ma...@yahoo.com>wrote:
> Can you post your settings.xml so we can see what you already have done?
>
> Maarten
>
>
>
> ----- Original Message ----
> From: Shaikh Almas <er...@gmail.com>
> To: ivy-user@ant.apache.org
> Sent: Sun, June 6, 2010 11:24:06 AM
> Subject: Issue with Ivy custome resolver
>
> Hi,
> Can anyone help me with creating custom ivy resolver. I wish to extend
> URLResolver, such that it will have a new class say called ProxyURLResolver
> where i will set the proxy, resolve the artifact and then remove the proxy
> setting. I tried extending URLResolver directly before calling
> setRepository
> method and reseting after and had typedef as well in ivysettings.xml, but
> it
> didn't worked. Can you please help me by telling the exact steps that i
> need
> to follow to create new cutom resolver?
>
> Almas
>
>
>
>
>
Re: Issue with Ivy custome resolver
Posted by Maarten Coene <ma...@yahoo.com>.
Can you post your settings.xml so we can see what you already have done?
Maarten
----- Original Message ----
From: Shaikh Almas <er...@gmail.com>
To: ivy-user@ant.apache.org
Sent: Sun, June 6, 2010 11:24:06 AM
Subject: Issue with Ivy custome resolver
Hi,
Can anyone help me with creating custom ivy resolver. I wish to extend
URLResolver, such that it will have a new class say called ProxyURLResolver
where i will set the proxy, resolve the artifact and then remove the proxy
setting. I tried extending URLResolver directly before calling setRepository
method and reseting after and had typedef as well in ivysettings.xml, but it
didn't worked. Can you please help me by telling the exact steps that i need
to follow to create new cutom resolver?
Almas