开发者

Ant Ivy dependency resolution

开发者 https://www.devze.com 2023-01-27 03:10 出处:网络
I have the following dependency: <dependency org=\"foo\" name=\"bar\" rev=\"1.0\" conf=\"war-runtime->runtime\" />

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.


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>


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号