maven资源过滤

使用maven-->build-->resources-->resource-->filtering = true ,过滤资源文件,替换资源文件中${propertyName}的部分,可以配合maven profile使用

pom.xml

<build>
	<finalName>xxx-core</finalName> 
	<resources>
		<resource>
			<filtering>true</filtering>
			<directory>src/main/resources</directory>
			<includes>
				<include>**/*.xml</include>
				<include>**/*.properties</include>
			</includes>
		</resource>
	</resources>
</build>
<properties>
	<cassandra.port>9160</cassandra.port>
	<cassandra.ip>192.168.1.212</cassandra.ip>
</properties>
 

xxx.properties

cassandra.port=${cassandra.port}
cassandra.ip=${cassandra.ip}

猜你喜欢

转载自jerryzxm.iteye.com/blog/1559974