Skip to content

honourednihilist/gradle-postgresql-embedded

Folders and files

NameName
Last commit message
Last commit date

Latest commit

955dead · Mar 27, 2018

History

15 Commits
Nov 14, 2017
Mar 25, 2018
Apr 17, 2017
Apr 17, 2017
Mar 27, 2018
Mar 25, 2018
Mar 25, 2018
Aug 25, 2017
Apr 17, 2017
Apr 17, 2017

Repository files navigation

gradle-postgresql-embedded

Gradle plugin to run embedded PostgreSQL server, based on the postgresql-embedded project.

Installation

Build script snippet for use in all Gradle versions:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.com.github.honourednihilist:gradle-postgresql-embedded:0.4.0"
  }
}

apply plugin: "com.github.honourednihilist.gradle-postgresql-embedded"

Build script snippet for new, incubating, plugin mechanism introduced in Gradle 2.1:

plugins {
    id "com.github.honourednihilist.gradle-postgresql-embedded" version "0.4.0"
}

Usage

The gradle-postgresql-embedded plugin adds only one task - startPostgres. This task runs an embedded PostgreSQL server and stops it when the build is finished (by default). You can make your tasks dependent on it. Here is an example of how the plugin is used in a 'real-world' project - gradle-postgresql-embedded-example.

Configuration

These are all possible configuration options and its default values:

postgresEmbedded {
	version = "V10"
	host = "localhost"
	port = 0 // zero value means a random port
	dbName = "embedded"
	username = "username"
	password = "password"
	artifactStorePath = "~/.embedpostgresql" // where PostgreSQL distributions are stored after downloading, inside home directory by default 
	stopWhenBuildFinished = true
	timeoutMillisBeforeStop = 0
}

You can specify any supported version from postgresql-embedded, and a custom version of PostgreSQL as well.

For example, you can use versions from PostgreSQL Binaries if you need a newer (or older) version of PostgreSQL which is not supported by this plugin at the moment.

postgresEmbedded {
	version = "9.3.22-1"
}
postgresEmbedded {
	version = "10.3-1"
}

Packages

No packages published

Languages