• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

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

 
Ranch Hand
Posts: 64
Oracle Java Ubuntu
  • Mark post as helpful
  • send pies
  • 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:

webserviceClient(root)
---------SRC
----------------MAIN_DIRECTORY
------------------------JAVA_DIRECTORY
--------------------------------config.properties
--------------------------------log4j.xml
------------------------RESOURCES_DIRECTORY
----------------TEST_DIRECTORY
----------------WSDL_DIRECTORY
------------------------samplewsdl.wsdl
------------------------
----------------wsit-client.xml
----------------samplewsdl.xml
----------------jax-ws-catalog.xml

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.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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?"

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!