Environments Maven Plugin

Allows for the creation of Environment configurations, which can then be packaged into specific releases.

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

com.github.mikesena.maven.plugins
ArtifactId

ArtifactId

environments-maven-plugin
Last Version

Last Version

0.0.17
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Environments Maven Plugin
Allows for the creation of Environment configurations, which can then be packaged into specific releases.
Project URL

Project URL

https://github.com/mikesena/environments-maven-plugin
Source Code Management

Source Code Management

https://github.com/mikesena/environments-maven-plugin.git

Download environments-maven-plugin

How to add to project

<plugin>
    <groupId>com.github.mikesena.maven.plugins</groupId>
    <artifactId>environments-maven-plugin</artifactId>
    <version>0.0.17</version>
</plugin>

Dependencies

compile (3)

Group / Artifact Type Version
org.apache.maven : maven-core jar 3.0.3
org.apache.maven : maven-plugin-api jar 3.0.3
org.twdata.maven : mojo-executor jar 2.1.0

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.2

test (1)

Group / Artifact Type Version
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

environments-maven-plugin

Build Status

A Maven plugin to manage generation of multiple environment configurations and artefacts, using the power of Maven, and without the headaches of hacking the build lifecycle.

Scenarios

  • Build versions for multiple development environments, each with its own configuration
  • Different product versions, such as a standard / deluxe.

The plugin was originally created so that separate deployable packages could be created for test environments and production. This was achieved through this plugin creating multiple environment configurations, during the same build, which were then packaged by the Maven Assembly plugin into individual ZIP releases.

Installation

The plugin is available through Maven central (hosted by Sonatype).

<dependency>
    <groupId>com.github.mikesena.maven.plugins</groupId>
    <artifactId>environments-maven-plugin</artifactId>
    <version>0.0.17</version>
</dependency>

Goals

Currently, only one goal is available / required for the plugin to work.

<executions>
    <execution>
        <phase>generate-sources</phase>
        <goals>
            <goal>create-environment-configurations</goal>
        </goals>
    </execution>
</executions>

Configuration

Required Parameters

Parameter Description
environments List of environments that will be created.
outputDirectory Directory to create the environments.
propertiesDirectory Input directory, containing all the environment property files.
templateDirectory Directory containing the environment template.

Example

<configuration>
    <!-- Files here will be read and used for all environments. -->
    <commonPropertiesDirectory>src/main/properties</commonPropertiesDirectory>
    
    <!-- Environments to create.  Correlate to folders in 'preportiesDirectory'. -->
    <environments>
        <environment>env1</environment>
        <environment>env3</environment>
        <environment>env7</environment>
        <environment>prod</environment>
    </environments>
    
    <!-- Location of the environment configurations. -->
    <propertiesDirectory>src/main/properties/envs</propertiesDirectory>
    
    <!-- Template to use as the base of each environment. -->
    <templateDirectory>src/main/environment-template</templateDirectory>
    
    <!-- Where files can be placed on completion. -->
    <outputDirectory>${project.build.directory}/environments</outputDirectory>
</configuration>

Optional Parameters

Parameter Description Default
commonPropertiesDirectory Directory, containing property files with common properties in them.
enforcePropertiesMustExist Performs a check, so that all environment files can guaranteed to all have the same proprety keys. true
filterOnFilenames Whether directory & file names are filtered (allows files to be renamed based on a property). true
overrideIfExists Whether to override files that already exist when creating an environment. true

Usage Examples

Versions

Version
0.0.17
0.0.16