1. Introduction

Provides additional configuration formats such as YAML and JSON. With this plugin installed you’ll be able to write any configuration file using YAML or JSON formats. For example, a typical Config.groovy file can be rewritten with JSON as

griffon-app/resources/Config.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
    "application": {
        "title"        : "Sample",
        "startupGroups": ["sample"],
        "autoShutdown" : "true"
    },
    "mvcGroups": {
        "sample": {
            "model"     : "com.acme.SampleModel",
            "view"      : "com.acme.SampleView",
            "controller": "com.acme.SampleController"
        }
    }
}

or with YAML

griffon-app/conf/resources/Config.yaml
1
2
3
4
5
6
7
8
9
application:
    title:         Sample
    startupGroups: sample
    autoShutdown:  true
mvcGroups:
    sample:
        model:      com.acme.SampleModel
        view:       com.acme.SampleView
        controller: com.acme.SampleController

Griffon version: 2.12.0

2. Build Configuration

2.1. Gradle

You have two options for configuring this plugin: automatic and manual.

2.1.1. Automatic

As long as the project has the org.codehaus.griffon.griffon plugin applied to it you may include the following snippet in build.gradle

dependencies {
    griffon 'org.codehaus.griffon.plugins:griffon-configuration-plugin:1.1.0'
}

The griffon plugin will take care of the rest given its configuration.

2.1.2. Manual

You will need to configure any of the following blocks depending on your setup

JSON Support
dependencies {
    compile 'org.codehaus.griffon.plugins:griffon-configuration-json:1.1.0'
}
YAML Support
dependencies {
    compile 'org.codehaus.griffon.plugins:griffon-configuration-yaml:1.1.0'
}

2.2. Maven

First configure the griffon-configuration-plugin BOM in your POM file, by placing the following snippet before the <build> element

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.codehaus.griffon.plugins</groupId>
            <artifactId>griffon-configuration-plugin</artifactId>
            <version>1.1.0</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Next configure dependencies as required by your particular setup

JSON Support
<dependency>
    <groupId>org.codehaus.griffon.plugins</groupId>
    <artifactId>griffon-configuration-json</artifactId>
</dependency>
YAML Support
<dependency>
    <groupId>org.codehaus.griffon.plugins</groupId>
    <artifactId>griffon-configuration-yaml</artifactId>
</dependency>

3. Modules

The following sections display all bindings per module. Use this information to successfully override a binding on your own modules or to troubleshoot a module binding if the wrong type has been applied by the Griffon runtime.

3.1. Configuration JSON

Module name: configuration-json

Depends on: configuration

bind(ResourceBundleLoader.class)
    .to(JsonResourceBundleLoader.class)
    .asSingleton();

3.2. Configuration YAML

Module name: configuration-yaml

Depends on: configuration

bind(ResourceBundleLoader.class)
    .to(YamlResourceBundleLoader.class)
    .asSingleton();