• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maven not populating properties from profile

 
John Gregory
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks,

John
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe you have filtering turned out for that particular file
 
John Gregory
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

John
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
John Gregory
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter,


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...

Thanks,

John
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a bug with the resources plugin which I found out about on a previous project:

http://jira.codehaus.org/browse/MRESOURCES-104

This exists in versions prior to 2.5. Which version are you on? And do you have the @ token in your properties file.
 
Tim Holloway
Saloon Keeper
Posts: 18302
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic