下面是我的个人制作解决方案。
pom.xml:
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<version>1.0.13.0-dev</version>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
...
base.jsp:
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE html>
<html>
<head></head>
<body>
<a href='<c:url value="/"/>'>
<spring:eval expression="@props.getProperty('version')"/>
</a>
<jsp:include page="${contentPage}" />
</body>
</html>
项目属性:
version=${project.version}
应用上下文.xml:
<bean id="props" class="org.springframework.beans.factory.config.PropertiesFactoryBean" autowire="byName" >
<property name="location" value="classpath:proj.properties"/>
</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:proj.properties"/>
</bean>
要不就
<util:properties id="props" location="classpath:proj.properties"/>