1

We manage our jars through ivy. Our project is dependant on Common.jar which ivy handles for us. This is all great and pulls the latest jar from the repository to the local repository.

However, our team want to make changes to Common.jar and test it against the project before committing. I would like to add Common.jar to our local classpath which will essentially override the ivy dependency in the local repository.

What is the best approach here? Should I add Common.jar to the lib directory and add to the build path?

Decrypter
  • 2,784
  • 12
  • 38
  • 57

2 Answers2

0

I think you want your local resolver to be in "force mode". Set the force="true" on your local resolver in ivysettings.xml.

See the description of force mode at: http://ant.apache.org/ivy/history/latest-milestone/settings/resolvers.html

(Ref: Ivy: Forcing local snapshot for dependency)

Community
  • 1
  • 1
0

Use configurations to differentiate your dependencies

<configurations>
   <conf name="common" description="Used for common jar"/>
   <conf name="others" description="Other 3rd party dependencies"/>
   <conf name="norm" extends="common,others" description="Normal complete list of dependencies"/>
</configurations>

<dependencies>
   <dependency ... module="common" ... conf="common->default"/>

   <dependency ... conf="others->default"/>
   <dependency ... conf="others->default"/>
</dependencies>

Note how the "extends" attribute can be used to create a union set of dependencies. You can then create classpaths within your build whose contents are controlled by ivy

<ivy:cachepath pathid="others.path" conf="others"/>
<ivy:cachepath pathid="norm.path"   conf="norm"/>

The first path is used for testing against a locally built common.jar. The second path will additionally contain the common jar retrieved from your repo.

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185