如何在jsp页面中获取maven项目版本号? [英] How can I in a jsp page get maven project version number?

查看:531
本文介绍了如何在jsp页面中获取maven项目版本号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究由maven2管理的java Web应用程序。我们不时做了一些更改,并希望做新版本,当然还有新的版本号。在主页(jsp)中,有文字如

I am working on a java web application, managed by maven2. From time to time, we did some changes, and want to do new releases, of course with new version number. In the homepage (jsp), there is text like

<b>version:</b> 2.3.3... 

是否有可能,每次我发布新版本时,我只会更改pom.xml中的< version /> ,jsp中的版本号可以由此maven $ {project.version}自动填充?

Is it possible, every time I do a new release, I only change the <version/> in pom.xml, and version number in jsp can be automatically filled by this maven ${project.version}?

我试过maven个人资料,但它似乎没有用。

I tried maven profile, however it doesn't seem to work.

任何想法?

谢谢。

推荐答案

这可能是愚蠢但我会使用。属性文件,如此示例而不是直接过滤JSP。

It's maybe stupid but I'd use a .properties file like in this example instead of filtering directly the JSP.

这篇关于如何在jsp页面中获取maven项目版本号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆