(Quick Reference)

build-standalone

Purpose

Builds a runnable JAR file that contains the application and embeds Tomcat 8 or Jetty 7.

Description

Builds a JAR file in the target directory called standalone-<application version>.jar. This can be run with java -jar standalone-<application version>.jar and can take optional arguments for the context path, port, etc.

Since this script builds a war file if you don't specify an existing one, be sure to specify the correct environment to build with.

Usage:

grails [environment] build-standalone [jarname] [--jetty] [--warfile=<war file path>]

Examples:

// build a JAR with the production environment settings and keeping the default filename, using Tomcat
grails prod build-standalone

// build a JAR with the 'demo' environment settings in the current directory with a custom name, using Jetty
grails -Dgrails.env=demo build-standalone our_cool_demo.jar --jetty

Required arguments: none .

Optional arguments:

  • jarname - The directory and name of the JAR file being built (defaults to target/standalone-<application version>.jar, e.g. target/standalone-0.1.jar)
  • warfile - The path to an existing war file to embed
  • jetty - If specified use Jetty instead of Tomcat