问题
In Grails 2 we could define WAR filename like this:
grails.project.war.file = "target/${appName}.war"
How can I override the war filename in Grails 3?
Thanks Jeff.
I have added line like thisin build.gradle:
war {
archiveName "${war.baseName}.war"
}
回答1:
In build.gradle
you can do something like war.archiveName='jeff.war'
. See https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.War.html#org.gradle.api.tasks.bundling.War%3aarchiveName.
回答2:
A more detailed answer: Add this to wrapper task in build.gradle so it creates different war file name based on each environment.
war.archiveName="${war.baseName}_${grails.util.Environment.current.name}.war"
Then create war file like this.
grails -Dgrails.env=staging war
来源:https://stackoverflow.com/questions/33621966/create-grails-3-war-without-version-number