dogbane
dogbane

Reputation: 274838

Ant Ivy dependency resolution

I have the following dependency:

<dependency org="foo" name="bar" rev="1.0" conf="war-runtime->runtime" />

However, the jar I want this to resolve to is called foo_bar-g.jar.

At the moment it tries foo_bar.jar which fails because the jar does not exist.

Can I specify the name of my jar or a pattern in the dependency?

I have a list of resolvers specified in an ivy-settings.xml file, but this file is shared across other apps so I can't change it.

Upvotes: 2

Views: 960

Answers (2)

dogbane
dogbane

Reputation: 274838

I figured this out:

In ivy_settings.xml add a custom resolver:

  <resolvers>    
    <filesystem checkconsistency="false" checkmodified="true" name="foo.bar">
      <artifact pattern="//path/to/foo_bar-g.[ext]"/>
    </filesystem>
  </resolvers>

State that you want to use this resolver for the bar module.

  <modules>
    <module name="bar" organisation="foo" resolver="foo.bar"/>
  </modules>

Then in ivy.xml:

<dependency org="foo" name="bar" rev="1.0">
        <artifact name="bar" type="jar" ext="jar" conf="war-runtime->runtime"/>
</dependency>

Upvotes: 2

John Engelman
John Engelman

Reputation: 4429

I'm not completely following your question as stated here. The dependency statement should look at at how the "runtime" configuration is defined in the foo.bar ivy.xml. That's where it states which jar file to look at in the repository.

When it gets it, then the file will be copied down depending on how your resolver is set up. The would typically be bar-1.0.jar

Where is the problem occuring? In the resolution? Or is it resolving and the local file is named differently than you want?

Upvotes: 0

Related Questions