ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marko Asplund <>
Subject Configuration and dependency declaration questions
Date Fri, 08 Jun 2012 07:56:49 GMT

I'm just starting off using Ivy (v2.3) in a project where I'm
converting an existing codebase to use Ivy for dependency management.
In the first stage I'm just going to fetch all the publicly available
dependencies from Maven central and later use our own artifact
repository for publishing our custom artifacts.

I'd like to define dependency categories similar to Maven compile,
runtime and test dependency scopes.
The runtime dependency set should also include compile-time
dependencies and test should include compile and runtime dependencies.

Currently we have just a pile of jar files with no dependency
information available.
What's the best way to determine the dependencies? I've started with
the following approach which is very time consuming. Is there a better
way to do this?

- determine compile-time dependencies
  check import statements from source code. For each import add the
corresponding dependency to compile conf.
  delete jars one-by-one, compile. If build fails, add required
dependencies. Rebuild and iterate.
- determine runtime dependencies
  build package, deploy and test. If any dependencies are missing, add
them to the runtime conf. Iterate.
- cross check original set of jar files. Remove any files that aren't
present in the original runtime set using explicit exclusions.

How to should I define the configurations exactly in this case?
What about configuration mappings? What exactly is the reason I need
to declare configuration mappings like "compile->default" in this
case? Dependencies don't seem to get fetched without it.
Here's what my Ivy file looks like:

    <conf name="compile" />
    <conf name="runtime" extends="compile"/>
    <conf name="test" extends="compile,runtime"/>
    <dependency org="log4j" name="log4j" rev="1.2.9" conf="compile"/>
    <dependency org="org.springframework" name="spring-core"
rev="2.0.2" conf="compile"/>
    <dependency org="mysql" name="mysql-connector-java" rev="5.1.6"

Does this look reasonable?

How should I manage exclusions? For example servlet-api is required
for compilation and it's included in runtime config via a transitive
dependency. What's the best way to exclude it? Should i explicitly
include it in compile config and exclude it from the runtime

Some artifacts bring in unwanted transitive dependencies e.g.
commons-httpclient brings in junit which I don't want to include in
the runtime config. Should I just exclude these one-by-one? Another
option would be to always skip transitive dependencies but that would
seem to undermine the whole idea of using a dependency manager.
Also, I've run into quite a few errors when transitive dependencies
fail to get loaded. Apparently, I need to declare these explicitly as
well to satisfy the dependencies.

There are some logical dependency groups e.g. Spring framework
dependencies include multiple jars.
Should i create a separate configuration for these dependencies?


View raw message