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 David Benua <db...@panix.com> on 2008/02/06 22:34:22 UTC

Configuration from remote repositories

We're just starting out with Ivy, and I have some questions about how to 
set up configuration in 2.0.

We have built our own repository, and I'd like to store as much of the 
configuration as possible with the repository. When the repository is on 
a file system, this is easy: in the <ivysettings> just <include 
file="/path/remote/directory/ivysettings.xml" />

However, we're a distributed team (spread across 8 time zones and 2 
continents), and we cannot guarantee file access from everywhere.  Also, 
we have some team members who will build "applications" which don't need 
to be published into Ivy (and others who maintain library modules which 
must be published).

My plan was to use a dual protocol structure: use http for resolve and 
retrieve and use sftp when we publish a module.  I've put a copy of our 
repository up on a server with linux / apache and I can perform retrieve 
from both http and sftp.

What I cannot figure out is how to manage the configuration of the 
repository.  You cannot "include" a URL, and of course the URL is 
slightly different between the 2 protocols.  (I've also tried specifying 
the settings file url in the <settings> or <configure> node, and that 
doesn't work properly: it still looks for ivysettings.xml in my local 
directory)

We can place "sample" ivysettings.xml files up on the web server (and 
have project authors add them to the build files), but this isn't the 
same as having them centrally located where we can make changes to 
repository structure should we need to.

Any thoughts on the best way to configure this?

Dave


Re: Configuration from remote repositories

Posted by Xavier Hanin <xa...@gmail.com>.
On Feb 7, 2008 11:28 AM, David Benua <db...@panix.com> wrote:

> Xavier,
>
> In my usage scenario, any sub-project that needs to "publish" (i.e. a
> reusable library module) will need BOTH resolvers.  They will use the
> HTTP resolver to "retrieve" their dependencies, and the SFTP resolver to
>  "publish" their artifacts after a build.
>
> Subprojects which don't publish (because their code isn't re-used by
> other applications / customers) just "retrieve" from HTTP, they don't
> need SFTP at all. (These subprojects are still in SVN, just not in Ivy).
>
> I did this for 2 reasons:
> 1) Performance of the HTTP resolver is much faster, and some of our
> users are a long way away over slow VPN or SSH connections.
> 2) We can give wide access to everybody (HTTP allows public
> reading/browsing) and control updates more tightly.

It makes a lot of sense, I misunderstood your use case.

Xavier


>
>
> Dave
>
>
> Xavier Hanin wrote:
> >
> > Since only one of the two resolvers is used at a time (if I understand
> > correctly), I'd rather define only one in two different settings files
> > (with the same name), and include either one or the other file depending
> > on the environment. You can do this with a naming convention for the
> > file name and using a property to define which file to load. But it's
> > mainly a matter of taste, behavior should be the same.
> >
> > Xavier
>
>


-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/

Re: Configuration from remote repositories

Posted by David Benua <db...@panix.com>.
Xavier,

In my usage scenario, any sub-project that needs to "publish" (i.e. a 
reusable library module) will need BOTH resolvers.  They will use the 
HTTP resolver to "retrieve" their dependencies, and the SFTP resolver to 
  "publish" their artifacts after a build.

Subprojects which don't publish (because their code isn't re-used by 
other applications / customers) just "retrieve" from HTTP, they don't 
need SFTP at all. (These subprojects are still in SVN, just not in Ivy).

I did this for 2 reasons:
1) Performance of the HTTP resolver is much faster, and some of our 
users are a long way away over slow VPN or SSH connections.
2) We can give wide access to everybody (HTTP allows public 
reading/browsing) and control updates more tightly.

Dave


Xavier Hanin wrote:
> 
> Since only one of the two resolvers is used at a time (if I understand 
> correctly), I'd rather define only one in two different settings files 
> (with the same name), and include either one or the other file depending 
> on the environment. You can do this with a naming convention for the 
> file name and using a property to define which file to load. But it's 
> mainly a matter of taste, behavior should be the same.
> 
> Xavier


Re: Configuration from remote repositories

Posted by Xavier Hanin <xa...@gmail.com>.
On Feb 7, 2008 1:32 AM, David Benua <db...@panix.com> wrote:

> Xavier,
>
> Thanks for the quick turnaround on this.
>
> I've tried it, and as you said, it works (even if it's not documented).
> Here are the settings (so far) in the remote directory:
>
> <ivysettings>
>    <property name="repo.path" value="/home/ivyrep/repo" />
>    <resolvers>
>       <url name="local-http" >
>          <ivy
> pattern="${ivy.settings.dir}/[organization]/[module]-ivy-[revision].xml"
> />
>          <artifact
> pattern="${ivy.settings.dir
> }/[organization]/[module]/[revision]/[artifact]-[revision].[ext]"
> />
>          <artifact
> pattern="${ivy.settings.dir
> }/[organization]/[module]/[revision]/[artifact].[ext]"
> />
>       </url>
>       <sftp name="local-sftp" host="${ivyrepo.host}"
> port="${ivyrepo.port}" user="${ivyrepo.user}"
> userPassword="${ivyrepo.password}" >
>          <ivy
> pattern="${repo.path}/[organization]/[module]-ivy-[revision].xml" />
>
>          <artifact
> pattern="${repo.path
> }/[organization]/[module]/[revision]/[artifact]-[revision].[ext]"
> />
>          <artifact
> pattern="${repo.path}/[organization]/[module]/[revision]/[artifact].[ext]"
> />
>       </sftp>
>     </resolvers>
> </ivysettings>


Since only one of the two resolvers is used at a time (if I understand
correctly), I'd rather define only one in two different settings files (with
the same name), and include either one or the other file depending on the
environment. You can do this with a naming convention for the file name and
using a property to define which file to load. But it's mainly a matter of
taste, behavior should be the same.

Xavier

>
> I've been able to retrieve with both resolvers. I'm sure that I'll have
> to add more options once we get going for real.  I expect we'll need to
> have integration (SNAPSHOT) builds, and separate configurations for
> building and testing, so I'm sure this will evolve before we're fully
> running.
>
> >
> >      (I've also tried specifying
> >     the settings file url in the <settings> or <configure> node, and
> that
> >     doesn't work properly: it still looks for ivysettings.xml in my
> local
> >     directory)
> >
> > This is strange and is clearly a bug. Could you open an issue with more
> > details about what you tried?
>
> All I tried was specifying an HTTP url in the <settings> tag.  Thinking
> about it now, it's not something that really would have helped: we're
> going to need some local configuration options, and this approach would
> not have worked.
>
> Dave
>
>
>
>


-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/

Re: Configuration from remote repositories

Posted by David Benua <db...@panix.com>.
Xavier,

Thanks for the quick turnaround on this.

I've tried it, and as you said, it works (even if it's not documented). 
Here are the settings (so far) in the remote directory:

<ivysettings>
    <property name="repo.path" value="/home/ivyrep/repo" />
    <resolvers>
       <url name="local-http" >
          <ivy 
pattern="${ivy.settings.dir}/[organization]/[module]-ivy-[revision].xml" />
          <artifact 
pattern="${ivy.settings.dir}/[organization]/[module]/[revision]/[artifact]-[revision].[ext]" 
/>
          <artifact 
pattern="${ivy.settings.dir}/[organization]/[module]/[revision]/[artifact].[ext]" 
/>
       </url>
       <sftp name="local-sftp" host="${ivyrepo.host}" 
port="${ivyrepo.port}" user="${ivyrepo.user}" 
userPassword="${ivyrepo.password}" >
          <ivy 
pattern="${repo.path}/[organization]/[module]-ivy-[revision].xml" />

          <artifact 
pattern="${repo.path}/[organization]/[module]/[revision]/[artifact]-[revision].[ext]" 
/>
          <artifact 
pattern="${repo.path}/[organization]/[module]/[revision]/[artifact].[ext]" 
/>
       </sftp>
     </resolvers>
</ivysettings>

I've been able to retrieve with both resolvers. I'm sure that I'll have 
to add more options once we get going for real.  I expect we'll need to 
have integration (SNAPSHOT) builds, and separate configurations for 
building and testing, so I'm sure this will evolve before we're fully 
running.

> 
>      (I've also tried specifying
>     the settings file url in the <settings> or <configure> node, and that
>     doesn't work properly: it still looks for ivysettings.xml in my local
>     directory)
> 
> This is strange and is clearly a bug. Could you open an issue with more 
> details about what you tried?

All I tried was specifying an HTTP url in the <settings> tag.  Thinking 
about it now, it's not something that really would have helped: we're 
going to need some local configuration options, and this approach would 
not have worked.

Dave




Re: Configuration from remote repositories

Posted by Xavier Hanin <xa...@gmail.com>.
On Feb 6, 2008 10:34 PM, David Benua <db...@panix.com> wrote:

> We're just starting out with Ivy, and I have some questions about how to
> set up configuration in 2.0.
>
> We have built our own repository, and I'd like to store as much of the
> configuration as possible with the repository. When the repository is on
> a file system, this is easy: in the <ivysettings> just <include
> file="/path/remote/directory/ivysettings.xml" />
>
> However, we're a distributed team (spread across 8 time zones and 2
> continents), and we cannot guarantee file access from everywhere.  Also,
> we have some team members who will build "applications" which don't need
> to be published into Ivy (and others who maintain library modules which
> must be published).
>
> My plan was to use a dual protocol structure: use http for resolve and
> retrieve and use sftp when we publish a module.  I've put a copy of our
> repository up on a server with linux / apache and I can perform retrieve
> from both http and sftp.
>
> What I cannot figure out is how to manage the configuration of the
> repository.  You cannot "include" a URL, and of course the URL is
> slightly different between the 2 protocols.

A bit surprised by that, I've checked the documentation and you're right,
you can't include an URL. Still surprised, I've checked the code, and you
actually you can include a URL :-)

For the sligh difference between the two URLs, you can use a property set
from your Ant build for example. If you need to include relative files, you
can use ${ivy.settings.dir} as basis.


 (I've also tried specifying
> the settings file url in the <settings> or <configure> node, and that
> doesn't work properly: it still looks for ivysettings.xml in my local
> directory)

This is strange and is clearly a bug. Could you open an issue with more
details about what you tried?


Xavier


>
>
> We can place "sample" ivysettings.xml files up on the web server (and
> have project authors add them to the build files), but this isn't the
> same as having them centrally located where we can make changes to
> repository structure should we need to.
>
> Any thoughts on the best way to configure this?



>
>
> Dave
>
>


-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/