Help coderanch get a
new server
by contributing to the fundraiser
  • 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Filtering problem using maven-read-properties plugin in pom.xml file

Ranch Hand
Posts: 64
Oracle Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody, in an older post I ask for some help to create a pom.xml in which I could set properties in some project's files using the pom.xml based on an external properties files. I finally achieved my purpose, well I thought so because when I run the mvn install, not all the files variables are being replaced. My project is a Web Service Client (METRO based), the structure of my project is like this:


Kind of complex, the point is that the files I want to set the variables are located in different parts, some of them in the root of SRC, some of them inside JAVA directory and not inside resources, another resource is located inside WSDL directory. When I execute my pom.xml is like it builds the application and put the files inside classes directory inside target, but when I look for a META-INF autogenerated folder the files are still with the ${variable} reference. That's why I'm having problems with the deploy. I know the problem is in resource filtering tag, but I've tried everything and sometimes the filtering copies the source code but without any change of the ${variable} reference. Is there any way to replace all the resources in the SRC (which contains all the files) and generate the build with the variables replaced by the values specified in properties. I'll be really grateful if you could help me, my pom is as follows:

Thanks for your help, any advice will be really appreciated.
Posts: 5856
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to lines 24-27, you are not filtering anything that is being copied into the META-INF directory.

I recommend a slightly different directory structure:

This gets the three "orphan" config files out of the ssrc directory and into their own subdirectory. Then when you specify the resources directory for filtering (I assume that is lines 28-31), you don't have to be concerned with a lot of other junk being copied with it. Nor do you have to ask yourself questions such as "if I set the <directory> for two <resource> entries to the same location (lines 26 and 30), does this define two different instances of the resources being copied, or does one override the other?"

grapes are vegan food pellets. Eat this tiny ad:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic