I think the most astonishing thing here is that this functionality is baked in by default to Maven and Gradle, yet, there are no traces of its existence in the Ant/Ivy landscape (see for yourself!).
I have inherited a suite of JVM components that use Ant/Ivy as their build/dependency system. There are lots of dependencies between each of these components, which means making a change to one of them usually has a ripple effect requiring you to update Ivy dependencies and publish new version of upstream dependencies.
The old team maintaining these projects handled local development by publishing snapshot jars to a snapshot repo. I would like to replace this paradigm with a new one whereby snapshots are published to/resolved from the local Ivy cache.
I was able to find this very similar question but found the answer a bit lacking on details (particularly a fully stitched-together code snippet), in part because the question lacked any specific code examples. So I have created an SSCCE here and have pushed 2 GitHub repos:
- fizzbuzz-model, a Java library that defines a data model (some meaningless POJOs)
- fizzbuzz-app, a simple executable jar that depends on
fizzbuzz-model
as a dependency
What I am looking for here are the exact (that is, actual code, not pseudo-code) changes (likely to build.xml
, ivy.xml
or ivy-settings.xml
, or all three!) that will allow me to use the following local dev/test cycle:
- I make a change to
fizzbuz-model
and publish the change locally to the Ivy cache, preferably as a snapshotted version (such as1.0.0-SNAPSHOT
or similar) - From inside of the
fizzbuzz-app
root directory, I runant resolve
which pulls in those changes from the cached snapshot - Now I can make use of those changes in
fizzbuzz-app
Though not a hard requirement, I would ideally like to not have to manage version numbers manually. That is, when I publish fizzbuzz-model
locally, it overwrites the current binary with the same version (again, like fizzbuz-model-1.0.0-SNAPSHOT.jar
) instead of incrementing the buildnumber to, say, fizzbuzz-model-1.0.1-SNAPSHOT.jar
or similar). That way all I have to do when testing locally is publish fizzbuzz-model
and resolve fizzbuzz-app
.
Currently, when I publish fizzbuzz-model
, I get the following errors:
/Users/myuser/workspace/fizzbuzz-model/build.xml:52: impossible to publish artifacts for hotmeatballsoup#fizzbuzz-model;1.0: java.io.IOException: missing artifact hotmeatballsoup#fizzbuzz-model;1.0.0-SNAPSHOT!fizzbuzz-model.pom
at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:225)
at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:172)
To reproduce locally, clone both those projects and follow their READMEs, starting with fizzbuzz-model
. Can anyone spot where I'm going awry? Feel free to answer here and/or submit a PR, whichever you prefer! And thanks!