I have two projects as part of my multi- project build, ProjectA
and ProjectB
.
ProjectA
has a compile
dependency on ProjectB
. I also have automatic build number increments, whereby each project contains a versions.json
file containing the latest build number. I have gradle script that increments this build number on a gradle publish
.
Now, when a change is made to ProjectA
, and a gradle clean publish
is performed, ProjectB
is also deployed to Nexus, even though it hasn't changed. How can I stop this from happening?
Note that the build is always done from clean since this process happens by our CI server and is always done from a fresh clone, so a solution such as the following does not work:
publish {
onlyIf { jar.didWork }
}
How can I ensure that an artifact is onlt published to Nexus if it is different to the latest copy upstream? Perhaps one way to solve this is to not run the publish
on the dependent project. But how?