Custom-Named Grails WAR Files

Gradle provides the ability to customize the name of the WAR file that is generated from the Grails war command.

Grails uses the war gradle plugin, which specifies the following pattern to create the archive name:


To customize the name of a generated WAR file, add a war {} closure to the end of the build.gradle file. To remove a property from the name (such as the version), set it to an empty string. You can also include the name of the environment that the WAR file is being generated for by retrieving the Java system property grails.env. The name of the current project is and is the default value for baseName.

String env = System.getProperty("grails.env") ?: "production"war {    version ""    baseName    appendix env    }