Giter Site home page Giter Site logo

gradle-environments-plugin's Introduction

Gradle Environments Plugin Build Status

This plugin aims to help the development of projects using more than one configurations. Projects that have specific configurations for development, staging and production for instance, but not limited to it! It integrates seamlessly with gradle life cycle just put the files you want to be specific to a given environment inside its correspondent directory and voilá! You're all set and ready to go!

How to Apply the plugin?

    buildscript {
      repositories{
        mavenCentral()
      }
      dependencies {
        classpath: "com.github.marceloemanoel:gradle-environments-plugin:0.1"
      }
    }
    
    apply plugin: "environments"

Configuration:

Just create a directory for each environment you need at src/main/environment that should be enough to let you select witch environment you need.

    ├── src
    │   ├── main
    │   │   ├── environment
    │   │   │   ├── development
    │   │   │   │   ├── database.properties
    │   │   │   │   └── log4j.properties
    │   │   │   ├── staging
    │   │   │   │   ├── database.properties
    │   │   │   │   ├── log4j.properties
    │   │   │   └── production
    │   │   │   │   ├── database.properties
    │   │   │   │   ├── log4j.properties

Just by using this structure, the plugin knows that:

  • you have 3 environments
  • that when you need to generate resources, such as a Jar, War, Zip or any other thing that uses the task :processResources, it will ask wich environment you want to generate the resource and will copy the correct files to your src/main/resources.

Tasks

The plugin adds a new group of tasks Environment Tasks wich is composed by the following tasks:

selectEnvironment

Choose wich environment among the directory structure created at src/main/environment should be used. If any of the environment directory has a file named .default, it will be treated as the default choice if you don't select any of the given ones.

Depends On
None

copyEnvironmentFiles

Copy all the files from the selected environment to the main resources dir

Depends On
:selectEnvironment

loadEnvironmentConfiguration

Reads information from file env-properties.groovy and stores in the environment property

Depends On
:selectEnvironment
Requires Default Value
/env-properties.groovy None

gradle-environments-plugin's People

Contributors

marceloemanoel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gradle-environments-plugin's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.