问题
I have a Project A which depends on Project B; both are internal projects in active development. Say the latest Project A release is 1.1.2 which depends on Project B 1.1.1. Now we are developing Project A 1.2.0 which depends on the Project B 1.2.0 also in development.
<dependency org="my.org" name="projectB" rev="1.2.0" transitive="true" conf="..." changing="true"/>
New intergration builds for Project B 1.2.0 are pushed by the CI server in the common local repository, so thanks to "changing" everyone gets the latest integration builds as soon as they are published.
Say Bob is developing a new feature on Project A which requires some modifications to Project B; he publishes a new shapshot Project B 1.2.0 in his local private repository and his is picked up in the build because is more recent than the one in the common repository. So far all ok.
But if Alice commits something in Project B, the CI server pushes a new 1.2.0 on common repo, which is more recent than the one Bob has locally; now Bob gets the common version which overrides his local changes.
Of course I could use different names (using property files in a clever way that name does not have to end in ivy.xml), something like 1.2.0_snapshot for Bob, as long as Bob needs the local version, and then switch back to 1.2.0 when the common version is ok. But isn't there a way to force using artifact whose status is "snapshot" (that will always be the status of local builds) over the ones which have "integration" (the ones produced by CI server will always have that status) or higher?
I tried "latest.snapshot" but it takes the integration version, if more recent.
What is the best way to deal with this pattern?
回答1:
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
来源:https://stackoverflow.com/questions/7023302/ivy-forcing-local-snapshot-for-dependency