Let's say that you expose a few services over HTTP/SOAP using servicemix-http. If you are building several service assemblies, you will end up having several files containing:
You will certainly want all your services to be exposed on the same port, so it can become a bit tedious if you need to change them all, or if you need to change between different work environments (test, production, etc...).
When working with several service assemblies at the same time, I would recommend to use a hierachical organization for your maven projects:
| |- module1-http-su
| |- module1-jsr181-su
| \- module1-sa
| |- module2-http-su
| |- module2-jsr181-su
| \- module2-sa
This has several advantages: aside from organizing your code logically, you can use
mvn jbi:projectDeployat the root level, or at a sub-level.
So, now, how can we use maven for our properties ? Well, we just have to create them in the root pom:
Then, we need to enable maven resource filtering in our root pom:
And of course, we need to use them. So instead of the previous
xbean.xml, we can now use:
So now, if you want to switch your port, just change the root pom property and rebuild :-)
The next step is to use maven profiles to define environment and easily switch between those. This is maybe not useful for changing the HTTP port use, but if you configure some database access, you can easily switch between your production database and an embedded one for testing ...