Good day,

If the only thing different with the variations are the config files and
some dependencies, then I suggest you use #2. With regards to the shared
resources, you can do that now with the maven-remote-resources-plugin. So
you now have something like...

.
 |-- core
 `-- variations
      |-- variation-a
      |-- variation-b
      |-- variation-c
      :
      `-- variation-z

wherein your core has the common resource as well. Then you just bundle up
core, and process it in the variation-<xxx>.

Cheers,
Franz


vmassol wrote:
> 
> Hi,
> 
> I've never found a good answer to this use case so far so I'm curious  
> about how others have implemented it.
> 
> Imagine a project that generates a WAR. This WAR contains a config  
> file (say in WEB-INF/classes) that configures connection parameters  
> for the database.
> 
> Now imagine that your project wants to support several databases and  
> you want the ability to build for a given database.
> 
> I see 2 options:
> 
> Option 1
> -----------
> 
> * Use filtering
> * Use profiles to set the values for the different databases
> 
> Issues:
> 
> * In order to differentiate the generate WAR file name you'll need to  
> use <finalName> but the value set there won't be used for install/ 
> deploy which means that the WAR files users will see will always be  
> the same.
> 
> Idea for future:
> 
> * It would be nice if Maven had a <classifier> element under  
> <project> so that it would be possible to generate an artifact with a  
> classifier.
> 
> Option 2
> -----------
> 
> * Create one module per database, under a parent module
> * Create profiles in the parent module to conditionally include the  
> <module> to be built
> 
> Issues:
> 
> * Very heavy (one module per database) especially when the only  
> difference between the generated artifacts is only 3 lines in a  
> config file
> * Need a way to share common configuration between the modules, in  
> order to prevent duplication. For example if the config files only  
> contains 3 lines that are different for each database and there are  
> 100 lines in total, you don't want to duplicate the 97 lines in as  
> many modules as you have databases
> 
> What do people do? Is there some plan to support this use case in a  
> better fashion in the future?
> 
> Thanks
> -Vincent
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/What-is-the-Best-practice-for-generating-variations-of-an-artifacts--tf3414040s177.html#a10090623
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to