Spring property value lost when "build artifacts" effect on the file

Answered

Hello here,

I have a problème which has confused me for sevral months : 

Resume : The "Build Artifacts" do not fill my xml (in WEB-INF) with the correct property value.

 

Context : In the "Run configuration" of my server Tomcat, I added "build artifacts" in the "Before launch". And in the pom.xml, I have a property <sys.name>golden</sys.name> which I want to use for my profil config file.

 

Problem:

In my profil config file (in WEB-INF), I add the property-placeholder : 

<context:property-placeholder location="classpath:${sys.name}/golden.properties"/>

 

If compiling with "mvn clean install", the profil.xml in the Target will show : 

<context:property-placeholder location="classpath:golden/golden.properties"/>

 

But if there is any change in this file, the restart of my server will "build artifacts", and the profil.xml in the Target will become :

<context:property-placeholder location="classpath:${sys.name}/golden.properties"/>.

 

I've done some more tests with different properties. It turns out that whenever the action "build artifacts" rebuild the file (when there is a modif in the file), the value of property configurated in the pom will be lost.

 

I've searched the specification of "Compiled" "Builde project"..., I didn't find any useful information to resolve my problem.

I have some tweaks but I'd like to know what was happened indeed to make a final solution once for all.

 

Thank you for your attention.

Xin

0

Please sign in to leave a comment.