Reputation: 13327
I have a bunch of gradle settings, which I keep on copying from project to project. In maven I could use a super-pom or at least an archetype to re-use common things, without copying it manually every time. Is there a way to package common settings as a plugin and reuse them, or is there another way to roll up and share your companies standards in a re-usable way?
I would prefer to publish the common things in a maven repo, but any other way is also welcome.
Clarification: What I am basically looking for is something like
apply from: "foo"
and foo is not a local file, but in a jar on the classpath.
Upvotes: 5
Views: 1327
Reputation: 205
Beginner - Shared Gradle scripts:
One way to start could be to use a shared gradle package which could sit in your version control system. This could contain the common settings for all projects in .gradle files that can include IDE, server, test coverage etc settings - the boiler plate code.
Add these to your project and then refer/apply these settings via your project's build script, eg:
apply from: <path to the shared gradle file>.
Custom Gradle plugin:
You could write your plugin and resue it across projects. Here's a link for writing a custom gradle plugin for your enterprise needs.
http://www.gradle.org/docs/current/userguide/custom_plugins.html
Upvotes: 2