Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create grails war without version number

Tags:

grails

In case anybody comes upon this article and is using Grails 1.3.x, the configuration option has changed from grails.war.destFile in Config.groovy to being grails.project.war.file in BuildConfig.groovy.

Also the file name is relative to the project workspace, so it should have a value like:

grails.project.war.file = "target/${appName}.war"

This is according to the latest Grails documentation.


I think you can specify the war name in the war command.

grails war foo.war

Also check the latest Grails documentation for where to set this as a configuration option. See the other answers for details.


From the Grails Documentation, Chapter 17, Deployment

There are also many ways in which you can customise the WAR file that is created. For example, you can specify a path (either absolute or relative) to the command that instructs it where to place the file and what name to give it:

grails war /opt/java/tomcat-5.5.24/foobar.war

Alternatively, you can add a line to Config.groovy that changes the default location and filename:

grails.war.destFile = "foobar-prod.war"

Of course, any command line argument that you provide overrides this setting.


Rolling up the other excellent answers. There are several options:

Explicitly set it on the command line: grails war foo.war

Set the app.version property to empty in application.properties will cause the war to be named foo.war.

Explicitly set the name of the war using the grails.war.destFile property in Config.groovy


Grails 3.x has switched to gradle and uses the war plugin. You can just specify name like this in the build.gradle file:

war {
    archiveName 'foo.war'
}