Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best way to share configuration between different projects?

We've got 3-5 different projects. I don't wanna copy/paste each time some parts of configuration from one project to another (like adding common maven repository). What's the best way to share common configuration across different projects?

I've used apply from: "http://path/to/common.build.gradle" construction but our architector thinks that this is not the best solution because project build depends on external server that stores common.build.gradle. If you don't have connection to this server you can't build project. What do you think about it?

like image 654
fedor.belov Avatar asked Jan 15 '14 07:01

fedor.belov


1 Answers

The most reliable way to share configuration between builds is to code it up as a plugin class (i.e. a class implementing the org.gradle.api.Plugin interface), publish it as a Jar to a Maven or Ivy repository, and pull it in to consuming builds using a buildscript block. This will make sure that the plugin Jar gets cached like any other artifact dependency. How to go about this is explained in the Gradle User Guide.

like image 119
Peter Niederwieser Avatar answered Oct 10 '22 19:10

Peter Niederwieser