Fork me on GitHub

The dotenv (.env) plugin for the maven build process

This plugin allows for the 12-factor app recommended flow of loading in values from environment variables. A lot of the existing maven processes allowed you to specify things were loaded from environment variables, but setting those values was kind of ugly. I like to be able to provide an .env.dist file and .gitignore the .env file, while also having the project to be buildable from initial checkout.

I could have renamed pom.xml to pom.xml.dist and had a bunch of values be filled in, but making this allowed me to learn more about how maven plugins work and are built.

So ya, if you plan on using this, good luck!

Here’s a link to the project I built this plugin for.

Prerequisites

The plugin requires Maven 3.3.9 or later and Java 8 or later. If you’re not on that version yet, you’re out of luck.