views:

372

answers:

1

I have a couple of jar files, (some of which depend on each other), and I'm trying to have ivy manage them for my project.

I do not want to create a "local" (user dir based) repository, because I want other users to be able to check out my svn project and run it without local/shared repository setup. For a variety of reasons, I cannot add these files to the actual repository we are using.

The project depends upon these files and I am using them in SVN. In the past, I have had my normal ivy dependency xml files. These files use a settings xml file points to the remote repository. In the past, at the last minute, I had ant use a build task to copy these files from a lib folder into the built folder. This feels like a broken abuse which ignores the features of ivy filesystem resolver.

(ivy.xml and build.xml for 3 buildable projects use the same ivysettings.xml, in another base directory.)

I feel like I'm 90% of the way there, what should I point my filesystem resolver at in ivysettings.xml to make my first resolve in the resolver chain check for jar files in projectdir/lib?

A: 

Have you looked at the ivy task buildlist?

You could use this to control the order in which your 3 modules are built. As each module is built it can publish to a local repository, ensuring that the jar is present in time for the next module in the chain.

   build.xml
   ivysettings.xml
   --> module1 --> build.xml
                   ivy.xml
   --> module2 --> build.xml
                   ivy.xml
   --> module3 --> build.xml
                   ivy.xml

You settings file can be shared by all projects. It states that the modules you build are available locally, everything else is from the default repository available to all users of your project (In this case Maven)

<ivysettings>
        <settings defaultResolver="maven2"/>
        <resolvers>
                <ibiblio name="maven2" m2compatible="true"/>

                <filesystem name="local">
                    <ivy pattern="${local.rep.dir}/..
                    <artifact pattern="${local.rep.dir}/..
                </filesystem>
        </resolvers>
        <modules>
                <module organisation="org.me" name="module1" resolver="local"/>
                <module organisation="org.me" name="module2" resolver="local"/>
                ..
        </modules>
</ivysettings>

Finally when you publish externally you can use the ivy install task to copy the modules you've already published locally into the final repository location

Mark O'Connor