This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
We use maven as our build tool...for better for worse. In my pom, I define a set of default properties and values for those
properties. I also create profiles and have properties set. In the application, I have a jndi properties file in which the values
are set according to the values from the pom. for example, my keystore:
in the jndi.properties file
in the pom, it's set as:
In a profile, if I'm building on a windows platform, I may set it as follows:
However, after I build my app and examine the jndi.properties file, the value of keystore is still set to ${keystore}. For every other ${} parameter I have,
the value is picked up and set from the profile, whether it's specified from a -P option or the default profile.
Has anyone seen this before and if so, what may be causing the problem. So far, the only way to counter the problem is to hardcode the value in the
property file, which to me, defeats the purpose of profiles.
maybe you have filtering turned out for that particular file
John Gregory
Ranch Hand
Joined: Oct 05, 2006
Posts: 115
posted
0
Jayesh,
I'd have to say no, I'm not filtering. Within the properties file, there are about 10 different properties
I vary depending on environment, prod, development. In every case except the one, the value is
not picked up. This is frustrating because it's non consistent across poms. In a different pom, that
value will be set. To further complicate this, I copy/paste the profile values from pom-to-pom.
So there's no reason why it would work in one application and not the other.
Have you run the mvn build with the -X option? If I recall correctly, that option prints out all of the property values that it knows about. (The object here is to see if Maven is correctly reading the property value.)
I would then try changing the property name, say to "storekey", and see if that starts working. (The object here is to see if the word 'keystore' is somehow special.)
Does the @ character appear anywhere in the properties file? The text filtering mechnism uses two ways to define tokens: ${...} and @...@. Thus stray @'s can cause issues (I run into this every time I need to filter .bat files). To overcome this problem, see the 'delimeters' parameter: http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters
Thanks for the suggestion. I'll give the -X option a try when I get in on Mon. However as for it being a delimiter
issue, maybe. The thing is, I have another parameter, truststore, which does get set. Maybe it's bombing
after parsing the value for that...
Jayesh A Lalwani wrote:maybe you have filtering turned out for that particular file
What Jayesh is saying is that substitutions are not automatic when Maven copies properties files to build a target. You must designate a filter directory to hold sources which are to have substitution performed on them when they are copied.
Customer surveys are for companies who didn't pay proper attention to begin with.