This week's book giveaway is in the Open Source Projects forum.
We're giving away four copies of Eclipse Collections Categorically: Level up your programming game and have Donald Raab on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

maven not populating properties from profile

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 28822
212
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic