Daniel Gerson
Daniel Gerson

Reputation: 2209

Logging the versions of gradle dependencies used when building for reuse

I want to log out the versions of all dependencies for a gradle build to a file, so I can use that file to substitute all dependencies of all modules, so I can rebuild the exact same build later.

It's not possible to manage the dependency tree produced via version control in order to meet some legacy requirements, and given its complexity.

Upvotes: 1

Views: 151

Answers (2)

Rene Groeschke
Rene Groeschke

Reputation: 28653

To log the versions the solution Adam provided is the way to go. Alternatively you might be interested in the nebula dependency-lock plugin. This is a thirdparty plugin that allows you to use dynamic versions during dev time and lock it down for reproducable builds when you do a release.

cheers, René

Upvotes: 1

AdamSkywalker
AdamSkywalker

Reputation: 11609

Something like

configurations {
  compile.resolutionStrategy {
    eachDependency { DependencyResolveDetails details ->
       String group = details.requested.group;
       String name = details.requested.name;
       String version = details.requested.version;
       // log
    }        
  }
}

Upvotes: 1

Related Questions