ivy.xml and resolving `default` revision

401 views
Skip to first unread message

Frédérick Dubois

unread,
Jun 25, 2011, 2:57:51 PM6/25/11
to simple-build-tool
Hi,

I'm experimenting converting a java project from ant to sbt.

I'm using an ivy.xml in conjunction with externalIvyFile().

The thing is, I'm using `default` revisions (see my previous post for more information about this). So we have dependencies that look like this:

<dependency org="apache" name="commons-lang" rev="default" />

With ant, we extended org.apache.ivy.plugins.resolver.FileSystemResolver to resolve this default version. But sbt uses a rigid interface to ivy and it doesn't seem to be able to take a custom ivy resolver.

When not using an ivy.xml (specifying the dependencies in build.sbt) I solved this problem by writing a plugin that uses the `allDependencies` task and resolves the `default` versions by looking inside a java properties file.

But when using an ivy.xml file, I'm out of luck because the dependencies don't appear in libraryDependencies. So a couple of possibilities:

- Rewrite the ivy.xml file into inline dependencies. This one kinda sucks because there are potentially dozens of projects that would be converted, most with non-trivial ivy.xml.
- Add a resolver that extends org.apache.ivy.plugins.resolver.FileSystemResolver. This is currently impossible with sbt's ivy interface. I hacked the sbt sources to make it work but I'm not sure this is the best way.
- Make sbt parse ivy.xml file on sbt startup instead of on `update`. Could populate `libraryDependencies` and related SettingKeys after parsing ivy.xml, would be able to use my existing plugin and would better fit into the current sbt model to override stuff IMHO.

So it seems that with the current ivy.xml support it's either all or nothing.

Any suggestions?

Thanks,

-Fred

Mark Harrah

unread,
Jun 25, 2011, 4:28:45 PM6/25/11
to simple-b...@googlegroups.com
On Sat, 25 Jun 2011 14:57:51 -0400
Frédérick Dubois <fred....@gmail.com> wrote:

> Hi,
>
> I'm experimenting converting a java project from ant to sbt.
>
> I'm using an ivy.xml in conjunction with externalIvyFile().
>
> The thing is, I'm using `default` revisions (see my

> previous<http://groups.google.com/g/3867f92f/t/aa6f2e23a0fae068/d/65c2b07568dae759?q=#65c2b07568dae759>post


> for more information about this). So we have dependencies that look
> like this:
>
> <dependency org="apache" name="commons-lang" rev="default" />
>
> With ant, we extended org.apache.ivy.plugins.resolver.FileSystemResolver to
> resolve this default version. But sbt uses a rigid interface to ivy and it
> doesn't seem to be able to take a custom ivy resolver.

There is a raw resolver where you can provide a custom Ivy resolver.

http://harrah.github.com/xsbt/latest/api/sbt/RawRepository.html

-Mark

> When not using an ivy.xml (specifying the dependencies in build.sbt) I
> solved this problem by writing a plugin that uses the `allDependencies` task
> and resolves the `default` versions by looking inside a java properties
> file.
>
> But when using an ivy.xml file, I'm out of luck because the dependencies
> don't appear in libraryDependencies. So a couple of possibilities:
>
> - Rewrite the ivy.xml file into inline dependencies. This one kinda sucks

> because there are potentially *dozens* of projects that would be converted,

Frédérick Dubois

unread,
Jun 25, 2011, 4:43:24 PM6/25/11
to simple-b...@googlegroups.com
Excellent, exactly what I needed, thanks!

> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To post to this group, send email to simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.
>
>

--
-Fred

Reply all
Reply to author
Forward
0 new messages