We use Gradle as the main build tool for our Java projects. Builds are scheduled by our Hudson CI server and artifacts are published with Gradle to our Artifactory server. Artifactory is also used for dependency resolution and referenced as a Maven repository within our Gradle setup.
The most annoying problem in this special constellation is that SNAPSHOT dependencies are not properly
updated for depending projects.
For example, if project B depends on project A and project A is currently in a SNAPSHOT state
(i.e. the version entry in the build.gradle
looks something like
'2.1.3-SNAPSHOT'
), then project B would not always get the latest
artifact version of project A.
Entries on the Gradle user mailing list, numerous blog posts, and some JIRA tickets
show that other people are facing similar problems, but there seems not to be a
common solution for this problem, but each solution depends on a very specific build environment and cannot simply be adopted in other constellations.
It is not clear to me whether this (in our constellation) is a Gradle problem, an general Ivy bug, a problem with the
Ivy Maven adapter or a missconfiguration of our artifactory server.
Recently, I tried several different solution approaches and found one in a
comment of GRADLE-629 which is actually working for us.
When configuring the project dependencies of a project, explicitly setting the changing
property for all
dependencies in SNAPSHOT state resolves
our update problems.
For example, project B from above would configure the project A dependency like
dependencies { compile ('my.fancy:project-a:2.1.3-SNAPSHOT') { changing=true } }Whenever a new version of project A is available in Artifactory, this latest version is downloaded when Gradle tasks are executed for project B.
Although this approach works, it still feels more like a workaround than a solution. If someone knows the real problem cause and a better solution, please feel free to comment.
No comments:
Post a Comment