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 Michael Richter <tt...@gmail.com> on 2010/07/15 09:09:00 UTC

"Portable" Ivy

By "Portable" here I mean in the form of
PortableApps<http://www.portableapps.com>:
applications which can be run straight off of a portable storage device
(like a USB stick) without leaving any footprint behind on the machine it's
used on.  I've managed to get a surprising amount of software working off of
the USB stick including, for example, Maven.  I can't seem to figure out the
same trick for Ivy.

The big issue for me is Ivy's repository.  I can't seem to find some way to
have Ivy use a repository whose location might change from invocation to
invocation.  The problem is that depending on the physical configuration my
Ivy installation (and attendant repository) might be on a different drive
each time.  With Maven I've managed to set up environment variables that
identify the drive and location of the Maven environment so that every time
I open up a command shell through my PortableApps menu I have Maven looking
in the right place for its repository.  I can't seem to figure out how to do
the same in Ivy.

The big problem for me is that I just can't see anywhere--like an
environment variable or command line options--I can TELL Ivy where things
are.  Everything seems to go from XML files that are in a per-project basis.
 Yet the tutorial mentions in passing setting an environment variable to
configure things -- it just neglects to mention which one.

Is there a way to do what I want with Ivy and if so, what is this method?

-- 
"Perhaps people don't believe this, but throughout all of the discussions of
entering China our focus has really been what's best for the Chinese people.
It's not been about our revenue or profit or whatnot."
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.

Re: "Portable" Ivy

Posted by Vladimir Ritz Bossicard <vl...@ritz-bossicard.com>.
On 15.07.2010 10:12, Michael Richter wrote:
> On 15 July 2010 15:57, Vladimir Ritz Bossicard
> <vl...@ritz-bossicard.com>wrote:
>
>    
>> Michael,
>>
>>   I can't seem to find some way to
>>      
>>> have Ivy use a repository whose location might change from invocation to
>>> invocation.  The problem is that depending on the physical configuration
>>> my
>>> Ivy installation (and attendant repository) might be on a
>>>
>>>        
>> I solved a similar problem by adding placeholders in the ivyconf.xml file:
>>
>> <filesystem name="localrepo" checkmodified="true">
>> <artifact
>> pattern="${localrepo.dir}/[organisation]/[module]/[revision]/conf/[artifact].[ext]"
>> />
>> <artifact
>> pattern="${localrepo.dir}/[organisation]/[module]/[revision]/lib/[artifact]-[revision].[ext]"
>> />
>> <artifact
>> pattern="${localrepo.dir}/[organisation]/[module]/[revision]/lib/[artifact].[ext]"
>> />
>> </filesystem>
>>
>> with ${localrepo.dir} simply being an Ant property.
>>      
>
> The problem here being that the localrepo will change from machine to
> machine as I move the USB stick.
>    
[I assume that your project's code will be somewhere on the machine and 
only the localrepo on the USB stick].

To solve this, you can have a build-local.properties files that stores 
"local" Ant properties (this file is local to the checked-out project 
and not checked into your Subversion).  Typically, I have:

     build.xml
     build.properties (checked in)
     build-local.properties (not checked in)

the ${localrepo.dir} is defined in the build-local.properties file only.

If the code and the repo are on the stick, I would rather have some 
<copy> target from renaming some build-local-host1.properties (or 
build-local-host2.properties) into build-local.properties before each 
ivy retrieval.

hth

-Vladimir

Re: "Portable" Ivy

Posted by Nicolas Lalevée <ni...@hibnet.org>.
On Thursday 15 July 2010 10:12:14 Michael Richter wrote:
> On 15 July 2010 15:57, Vladimir Ritz Bossicard
>
> <vl...@ritz-bossicard.com>wrote:
> > Michael,
> >
> >  I can't seem to find some way to
> >
> >> have Ivy use a repository whose location might change from invocation to
> >> invocation.  The problem is that depending on the physical configuration
> >> my
> >> Ivy installation (and attendant repository) might be on a
> >
> > I solved a similar problem by adding placeholders in the ivyconf.xml
> > file:
> >
> > <filesystem name="localrepo" checkmodified="true">
> > <artifact
> > pattern="${localrepo.dir}/[organisation]/[module]/[revision]/conf/[artifa
> >ct].[ext]" />
> > <artifact
> > pattern="${localrepo.dir}/[organisation]/[module]/[revision]/lib/[artifac
> >t]-[revision].[ext]" />
> > <artifact
> > pattern="${localrepo.dir}/[organisation]/[module]/[revision]/lib/[artifac
> >t].[ext]" />
> > </filesystem>
> >
> > with ${localrepo.dir} simply being an Ant property.
>
> The problem here being that the localrepo will change from machine to
> machine as I move the USB stick.

you could use the property ${ivy.settings.dir} which is the absolute path to 
the directory containing the ivysettings file.

In Ant you can also have the directory containg the build.xml file with:
<project name="myproject">
    <dirname property="myproject.dir" file="${ant.file.myproject}" />

Nicolas


Re: "Portable" Ivy

Posted by Michael Richter <tt...@gmail.com>.
On 15 July 2010 15:57, Vladimir Ritz Bossicard
<vl...@ritz-bossicard.com>wrote:

> Michael,
>
>  I can't seem to find some way to
>> have Ivy use a repository whose location might change from invocation to
>> invocation.  The problem is that depending on the physical configuration
>> my
>> Ivy installation (and attendant repository) might be on a
>>
> I solved a similar problem by adding placeholders in the ivyconf.xml file:
>
> <filesystem name="localrepo" checkmodified="true">
> <artifact
> pattern="${localrepo.dir}/[organisation]/[module]/[revision]/conf/[artifact].[ext]"
> />
> <artifact
> pattern="${localrepo.dir}/[organisation]/[module]/[revision]/lib/[artifact]-[revision].[ext]"
> />
> <artifact
> pattern="${localrepo.dir}/[organisation]/[module]/[revision]/lib/[artifact].[ext]"
> />
> </filesystem>
>
> with ${localrepo.dir} simply being an Ant property.


The problem here being that the localrepo will change from machine to
machine as I move the USB stick.

-- 
"Perhaps people don't believe this, but throughout all of the discussions of
entering China our focus has really been what's best for the Chinese people.
It's not been about our revenue or profit or whatnot."
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.

Re: "Portable" Ivy

Posted by Vladimir Ritz Bossicard <vl...@ritz-bossicard.com>.
Michael,
> I can't seem to find some way to
> have Ivy use a repository whose location might change from invocation to
> invocation.  The problem is that depending on the physical configuration my
> Ivy installation (and attendant repository) might be on a
I solved a similar problem by adding placeholders in the ivyconf.xml file:

<filesystem name="localrepo" checkmodified="true">
<artifact 
pattern="${localrepo.dir}/[organisation]/[module]/[revision]/conf/[artifact].[ext]" 
/>
<artifact 
pattern="${localrepo.dir}/[organisation]/[module]/[revision]/lib/[artifact]-[revision].[ext]" 
/>
<artifact 
pattern="${localrepo.dir}/[organisation]/[module]/[revision]/lib/[artifact].[ext]" 
/>
</filesystem>

with ${localrepo.dir} simply being an Ant property.

hth

-Vladimir