Hi,

I wrote a relatively trivial plugin to load a local.gradle file to customise 
certain aspects of the build without too much tamtam in the build.gradle file. 
Although, it's really a trivial plugin it shows how nicely the Groovy DSL works 
with gradle. Feedback appreciated.

The source can be found on bitbucket: http://bit.ly/etlT0X

Here more details:

## Motivation

One has to specify the repositories where gradle looks for dependencies
in the `build.gradle`. However who says, that these repositories are
always the same? For example in my work place there is some local repository
proxy to be used. Now if I add it to the repositories, I can't compile
the project somewhere else.


Therefor I wrote this little plugin: it checks whether some `local.gradle`
file exists and loads it. This file might contain any customisations.
Especially for my use case I added repository helpers: `defaultRepositories`
and `localRepositories`.

## Usage

Load the plugin:

        apply plugin: "local-dotgradle"

Then basically nothing happens. You can use your `build.gradle` as before.
However if you create a file `local.gradle`, it will be loaded also. Ideally
this file is not contained in the source code repository, but only added
locally when there is a need for it.

To expand the example a little bit we will add some repositories.

        apply plugin: "local-dotgradle"
        
        defaultRepositories {
            mavenCentral()
        }

Without a `local.gradle` the build will just use maven central as desired.
However if we create the following `local.gradle` the build automatically
switches to the proxy definitions.

        localRepositories {
            mavenRepo urls: 'http://my.local.company/repository/proxy'
        }

Sincerely
Meikel


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to