java - Access maven project version in Spring config files -


i display running version of web application in page. project based on maven, spring, , wicket.

i'd somehow value of maven's ${project.version} , use in spring xml files, way use spring propertyplaceholderconfigurer read property file settings use in application.

if had maven project.version available variable in spring config, this:

<bean id="applicationbean" class="com.mysite.web.wicketapplication"> <property name="version"><value>${project.version}</value></property> </bean> 

how can this?

you can use maven filtering suggested.

or read pom.properties file created maven under meta-inf directory directly spring:

<util:properties id="pom"       location="classpath:meta-inf/groupid/artifactid/pom.properties" /> 

and use bean.

the drawback of later approach pom.properties created @ package phase time (and won't there during, say, test).


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -