开发者

Grails WAR file version

I would like to printout th开发者_如何学JAVAe grails war file version on my main page template, so when I deploy a WAR file, it become easy to recognize which version of the app is running on which server and so on.

Where to set it and how to print it out in a gsp tag?


There's a tag you can use as a short cut

<g:meta name="app.version"/>

You can set it using

grails set-version someVersionHere


I figured out how to display it but still don't know how to set it except by changing it in the application.properties

ApplicationName Version: ${grailsApplication.metadata['app.version']} Built by grailsApplication.metadata['app.grails.version']

I guess its the only way!!


To answer your question of SETTING the VERSION:

For example building with Jenkins or Hudson will automatically set the build number and CVS revision number to your war.

Using that sort of build tool + the Build Info plugin is a good way to achieve visibility to which version of your site you are running.

Of course setting up Jenkins takes some effort, but the it is a one-time cost and then you will just have button "Build Now" that will take care of it and you can optionally also configure deployment tasks to upload it automatically as well... but now I've drifted slightly off-topic.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜