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:

[baseName]-[appendix]-[version]-[classifier].[extension]

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 rootProject.name and is the default value for baseName.

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