Hi THanks for your suggestion, but I don't think it will work; for instance, I have to customize some springsecurity files that have to be included in the war file; those files are instantiated from templates that differ from environment to environment (LDAP, AD...); also, I don't want to copy all different logos to the war file, while only one should be used.
I'm using jndi for db parameters for instance. basically, my process is: update code for each environment (customer) customize package deploy package so I can't think of an easy way to extract the configuration, and build the package only once. Best regards Jean-Noël On 25 Feb 2013, at 21:42, Adrien Rivard <[email protected]> wrote: > On Mon, Feb 25, 2013 at 8:41 PM, Jean-Noël Colin <[email protected]> wrote: > >> Hi >> >> I'm trying to migrate my project from ant to maven, but I'm facing a few >> difficulties; I need to build my project for different environments >> (customers, so possibly a long list). In my ant project, I had several >> .properties file, one per customer; in this file, I had properties used to >> customize some config file; I managed to use resource filtering to achieve >> this. >> >> > The best way to handle this is to externalize your configuration.This way, > you build one time one war that never changed, and you deploy this one > along with the configuration file. > Since you already have properties you should just externalize them (spring > placeholder ..). Another option would be to use JNDI (more flexible but > also more complicated IMO) > > The second option is to multiple the number of project (1 master and a lots > of nearly empty one for each customers.), but this work only if you know > the configuration at build time. > > The Thing to not do is to build one project multiple times, but each time > different. (Basic maven rule : One project -> one artifact) > > >> However, some properties defined a filename that needed to be copied to >> the war archive, but under a common name. For instance, I had several >> logos: logo_customer1.jpg, logo_customer2.jpg, logo_customer3.jpg; the >> source file name was specified in the properties file >> (customer1.properties, customer2.properties, customer3.properties), but the >> destination was always logo.jpg. How can I do that? >> >> On a webapp, I usually read it through a Servlet that read the path > configured in the properties. > > > >> Second, the properties file defines the name of the file (resources) to be >> filtered. For instance, I have a template for working with Spring Security >> in LDAP environment and another template when working when Active >> Directory; the customer properties file defined the name of the template to >> use, but in both cases, the result file needs to be >> applicationContext-security.xml. How can i achieve this? Or is there a way >> to define conditional profiles so that in the customer .properties file, I >> would say LDAP or AD, and based on that value, different profile would be >> used? >> > > Spring can perfectly handle multiple authentication Manager, if only one is > configured, one will failed, the other will work. > > >> >> Many thanks for your help >> >> Jean-Noël >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > > -- > Adrien Rivard
