Identify status of resolved dependencies with Gradle 1.3

(detelinyordanov) #1

With Gradle 1.1 it was possible to identify the status of a resolved artifact by accessing its Ivy artifact’s status:

ResolvedArtifat resolvedArtifact = …

if (resolvedArtifact.artifact instanceof MDArtifact)

String status = (resolvedArtifact.artifact as MDArtifact).md.status

Of course this is non-public API and it was risky to rely upon it, but since there was no other way, we ended up using it nevertheless. Thus we were able to implement a task that verifies that all dependencies are at least as mature as the project being build. For example, if one is building a ‘milestone’ then the build would fail if any of the 1st-level dependencies’ artifacts is having an ‘integration’ status.

With Gradle 1.3, the ResolvedArtifact does not keep a reference to the Ivy artifact anymore (as per this change), so does anybody know another way of identifying the status of a resolved artifact?

I’m also looking into another way to enforce this - namely by using separate repositories for each status and restricting access to repositories with less mature status, but I stumbled upon another problem while doing it, see [Configure different set of repositories based on project status] (