General gradle settings / settings for all projects

I have a set of gradle options that I keep copying from project to project. In maven, I could use a super-pom or at least an archetype to reuse common things without manually copying it every time. Is there a way to pack the general settings as a plugin and reuse them, or is there another way to minimize and redistribute your company standards in a reusable way?

I would rather post general things in a maven repo, but any other way is also welcome.

Clarification: what I'm mostly looking for is something like

apply from: "foo" 

and foo is not a local file, but in the bank on the way to the classes.

+4
source share
1 answer
  • Initial - general Gradle script:

    One way to get started is to use a common Gradle package that can sit on your version control system. This may contain general settings for all projects in .gradle files, which may include IDE, server, test coverage parameters, etc. - boiler plate code.

    Add them to your project and then apply / apply these settings through your project script, for example:

     apply from: <path to the shared gradle file>. 
  • Custom Gradle Plugin:

    You can write your own plugin and execute it on all projects. Here you need a link to write a custom Gradle plugin for your enterprise.

    http://www.gradle.org/docs/current/userguide/custom_plugins.html

+2
source

Source: https://habr.com/ru/post/1491661/


All Articles