Re: Multiple packages with different configuration files

2010-11-22 Thread Barrie Treloar
On Tue, Nov 23, 2010 at 9:49 AM,   wrote:
> Eric,
>
> Let me elaborate on the issue. I cannot use profiles as it will create
> only one distribution for me. I need to have the same compiled cod
> bundled with different config files for DEV/QA/PROD. Is there are any
> easy way to create 3 TAR files from one jar or war and include different
> sets of config files within each of them? How can I implement it with
> Assembly mojo?

Apply Dont Repeat Yourself princiiples plus separation of concerns.

As someone already suggested the best way is to make your operations
team take your one EAR and apply the specific environment
configuration as part of the deployment process, how you do this is
specific to you application server.
The general practice appears to be having a directory included on the
application server's classpath and you put your applications specific
config files here.
The operations team need to keep their copies of the configuration
files up to date with any dev changes (like new configuration
variables).
Ideally you want to make this file as small as possible (i.e
production passwords and ip, port, url values)
Any values that are configurable, but dont generally change across
environments, like timeout values should be in another file.  These
values are configurable so you can tweak them without recompiling but
they would normally be the same across all environments. This
configuration file may be bundled in your applications jar, or
deployed into your application server config directory depending on
how easily you want people to be able to tweak these values.

Another approach (which I dont recommend) is to create a maven module
for each environment.
Then you can use the assembly plugin to bundle your EAR plus your per
environment configuration file into your tar.
The problem with this is you have just created X copies of your tar
(and normally it will use a large amount of disk space) where the only
difference is the configuration files.
You've saved your ops team a little effort by creating a single bundle
but you've just made your build/release process a lot slower.

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



RE: Multiple packages with different configuration files

2010-11-22 Thread Yanko, Curtis

The Assembly plugin can have multiple assemblies defined.

We produce one distribution with ALL configs in it though.


Curt Yanko | Continuous Integration Services | UnitedHealth Group IT 
Making IT Happen, one build at a time, 600 times a day
 

> -Original Message-
> From: ilya.may...@ubs.com [mailto:ilya.may...@ubs.com] 
> Sent: Monday, November 22, 2010 6:19 PM
> To: users@maven.apache.org
> Subject: RE: Multiple packages with different configuration files
> 
> Eric,
> 
> Let me elaborate on the issue. I cannot use profiles as it 
> will create only one distribution for me. I need to have the 
> same compiled cod bundled with different config files for 
> DEV/QA/PROD. Is there are any easy way to create 3 TAR files 
> from one jar or war and include different sets of config 
> files within each of them? How can I implement it with Assembly mojo? 
> 
> 
> Thanks
> 
> Ilya Mayzel
> Distributed Change Management
> UBS Financial Services Inc.
> 1000 Harbor Boulevard, 4th Floor
> Weehawken, NJ-07086
> Phone: 201-352-7976
> Email : ilya.may...@ubs.com
>  
> -Original Message-
> From: Haszlakiewicz, Eric [mailto:ehas...@transunion.com]
> Sent: Monday, November 22, 2010 3:38 PM
> To: Maven Users List
> Subject: RE: Multiple packages with different configuration files
> 
> 
> Well those are some rather useless answers.
> JNDI will only "do the job" if you configure it that way.  You need to
> get that configuration *into* tomcat somehow in the first place,
> regardless of whether you use JNDI or a properties file.
> 
> To suggest some options for the original poster:
>   There are several different options to choose which 
> configuration gets
> used or included in a application package.  One way, which I 
> have used a
> fair amount, is to include all configurations, and have an environment
> variable that you set when you run that app that causes it to 
> choose the
> right file.  The exact method of doing this depends on 
> exactly how your
> configuration is stored, but it might consist of things like having
> property references in spring config files, tomcat setenv.sh scripts
> that pass appropriate java options, or custom java code 
> within your app
> that looks for the variable settings.
> 
> On the other hand, if you want actual, separate application packages,
> each that only contains a single set of configuration 
> options, well then
> you're back in the realm of how to get maven to do that for you.  What
> I've done for this is use profiles with embedded ant tasks 
> that copy the
> appropriate files into place.  Then to build a dev 
> environment you might
> do something like "mvn -P dev package".  Of course, you can use any
> other plugin config within a profile other than the ant 
> plugin, such as
> having separate assembler plugin configs and include different
> configuration files that way.
> There's lots of way to do it; I'm not sure what the best one is.
> 
> eric
> 
> >-Original Message-
> >From: Ron Wheeler [mailto:rwhee...@artifact-software.com]
> >Sent: Monday, November 22, 2010 1:03 PM
> >To: users@maven.apache.org
> >Subject: Re: Multiple packages with different configuration files
> >
> >
> >JNDI will do the job on Tomcat.
> >
> >Ron
> >
> >
> >On 22/11/2010 1:47 PM, Antonio Petrelli wrote:
> >> 2010/11/22:
> >>> This app need to be packaged with different configuration files 
> >>> (server names/IP addresses) for Dev/QA/Prod environments.
> >> This kind of info are better put in the server. For example, for 
> >> JBoss, you can create a .properties file and put it inside:
> >> /server/ >> Everything in the conf directory is available in your classpath.
> >>
> >> Antonio
> >>
> >> 
> -
> >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> >> For additional commands, e-mail: users-h...@maven.apache.org
> >>
> >>
> >
> >
> >-
> >To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> >For additional commands, e-mail: users-h...@maven.apache.org
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
> 
> Please visit our website at 
> http://financialservicesinc.ubs.com/wealth/E-maildisclaimer.html 
> for importa

Re: Multiple packages with different configuration files

2010-11-22 Thread Brian Smith
I believe you can specify multiple executions.

See:

http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Plugins

I think you could use the EAR plugin for example with three separate
executions, each with a configuration that excludes different files.

Hope this helps.

On 22 November 2010 23:19,  wrote:

> Eric,
>
> Let me elaborate on the issue. I cannot use profiles as it will create
> only one distribution for me. I need to have the same compiled cod
> bundled with different config files for DEV/QA/PROD. Is there are any
> easy way to create 3 TAR files from one jar or war and include different
> sets of config files within each of them? How can I implement it with
> Assembly mojo?
>
>
> Thanks
>
> Ilya Mayzel
> Distributed Change Management
> UBS Financial Services Inc.
> 1000 Harbor Boulevard, 4th Floor
> Weehawken, NJ-07086
> Phone: 201-352-7976
> Email : ilya.may...@ubs.com
>
> -Original Message-
> From: Haszlakiewicz, Eric [mailto:ehas...@transunion.com]
> Sent: Monday, November 22, 2010 3:38 PM
> To: Maven Users List
> Subject: RE: Multiple packages with different configuration files
>
>
> Well those are some rather useless answers.
> JNDI will only "do the job" if you configure it that way.  You need to
> get that configuration *into* tomcat somehow in the first place,
> regardless of whether you use JNDI or a properties file.
>
> To suggest some options for the original poster:
>  There are several different options to choose which configuration gets
> used or included in a application package.  One way, which I have used a
> fair amount, is to include all configurations, and have an environment
> variable that you set when you run that app that causes it to choose the
> right file.  The exact method of doing this depends on exactly how your
> configuration is stored, but it might consist of things like having
> property references in spring config files, tomcat setenv.sh scripts
> that pass appropriate java options, or custom java code within your app
> that looks for the variable settings.
>
> On the other hand, if you want actual, separate application packages,
> each that only contains a single set of configuration options, well then
> you're back in the realm of how to get maven to do that for you.  What
> I've done for this is use profiles with embedded ant tasks that copy the
> appropriate files into place.  Then to build a dev environment you might
> do something like "mvn -P dev package".  Of course, you can use any
> other plugin config within a profile other than the ant plugin, such as
> having separate assembler plugin configs and include different
> configuration files that way.
> There's lots of way to do it; I'm not sure what the best one is.
>
> eric
>
> >-Original Message-
> >From: Ron Wheeler [mailto:rwhee...@artifact-software.com]
> >Sent: Monday, November 22, 2010 1:03 PM
> >To: users@maven.apache.org
> >Subject: Re: Multiple packages with different configuration files
> >
> >
> >JNDI will do the job on Tomcat.
> >
> >Ron
> >
> >
> >On 22/11/2010 1:47 PM, Antonio Petrelli wrote:
> >> 2010/11/22:
> >>> This app need to be packaged with different configuration files
> >>> (server names/IP addresses) for Dev/QA/Prod environments.
> >> This kind of info are better put in the server. For example, for
> >> JBoss, you can create a .properties file and put it inside:
> >> /server/ >> Everything in the conf directory is available in your classpath.
> >>
> >> Antonio
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> >> For additional commands, e-mail: users-h...@maven.apache.org
> >>
> >>
> >
> >
> >-
> >To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> >For additional commands, e-mail: users-h...@maven.apache.org
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
> Please visit our website at
> http://financialservicesinc.ubs.com/wealth/E-maildisclaimer.html
> for important disclosures and information about our e-mail
> policies. For your protection, please do not transmit orders
> or instructions by e-mail or include account numbers, Social
> Security numbers, credit card numbers, passwords, or other
> personal information.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>


RE: Multiple packages with different configuration files

2010-11-22 Thread ilya.mayzel
Eric,

Let me elaborate on the issue. I cannot use profiles as it will create
only one distribution for me. I need to have the same compiled cod
bundled with different config files for DEV/QA/PROD. Is there are any
easy way to create 3 TAR files from one jar or war and include different
sets of config files within each of them? How can I implement it with
Assembly mojo? 


Thanks

Ilya Mayzel
Distributed Change Management
UBS Financial Services Inc.
1000 Harbor Boulevard, 4th Floor
Weehawken, NJ-07086
Phone: 201-352-7976
Email : ilya.may...@ubs.com
 
-Original Message-
From: Haszlakiewicz, Eric [mailto:ehas...@transunion.com] 
Sent: Monday, November 22, 2010 3:38 PM
To: Maven Users List
Subject: RE: Multiple packages with different configuration files


Well those are some rather useless answers.
JNDI will only "do the job" if you configure it that way.  You need to
get that configuration *into* tomcat somehow in the first place,
regardless of whether you use JNDI or a properties file.

To suggest some options for the original poster:
  There are several different options to choose which configuration gets
used or included in a application package.  One way, which I have used a
fair amount, is to include all configurations, and have an environment
variable that you set when you run that app that causes it to choose the
right file.  The exact method of doing this depends on exactly how your
configuration is stored, but it might consist of things like having
property references in spring config files, tomcat setenv.sh scripts
that pass appropriate java options, or custom java code within your app
that looks for the variable settings.

On the other hand, if you want actual, separate application packages,
each that only contains a single set of configuration options, well then
you're back in the realm of how to get maven to do that for you.  What
I've done for this is use profiles with embedded ant tasks that copy the
appropriate files into place.  Then to build a dev environment you might
do something like "mvn -P dev package".  Of course, you can use any
other plugin config within a profile other than the ant plugin, such as
having separate assembler plugin configs and include different
configuration files that way.
There's lots of way to do it; I'm not sure what the best one is.

eric

>-Original Message-
>From: Ron Wheeler [mailto:rwhee...@artifact-software.com]
>Sent: Monday, November 22, 2010 1:03 PM
>To: users@maven.apache.org
>Subject: Re: Multiple packages with different configuration files
>
>
>JNDI will do the job on Tomcat.
>
>Ron
>
>
>On 22/11/2010 1:47 PM, Antonio Petrelli wrote:
>> 2010/11/22:
>>> This app need to be packaged with different configuration files 
>>> (server names/IP addresses) for Dev/QA/Prod environments.
>> This kind of info are better put in the server. For example, for 
>> JBoss, you can create a .properties file and put it inside:
>> /server/> Everything in the conf directory is available in your classpath.
>>
>> Antonio
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>>
>>
>
>
>-
>To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>For additional commands, e-mail: users-h...@maven.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Please visit our website at
http://financialservicesinc.ubs.com/wealth/E-maildisclaimer.html
for important disclosures and information about our e-mail
policies. For your protection, please do not transmit orders
or instructions by e-mail or include account numbers, Social
Security numbers, credit card numbers, passwords, or other
personal information.

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Multiple packages with different configuration files

2010-11-22 Thread Ron Wheeler

On 22/11/2010 3:38 PM, Haszlakiewicz, Eric wrote:

Well those are some rather useless answers.
JNDI will only "do the job" if you configure it that way.  You need to get that 
configuration *into* tomcat somehow in the first place, regardless of whether you use 
JNDI or a properties file.

I was not suggesting that an unconfigured Tomcat would do JNDI on its own.
The goal is to get the server specific configuration out of development 
teams hair and into the operations area.


We started out with bits of server configuration in the applications and 
of course, it caused all kinds of silly errors when the wrong things got 
deployed to the right place and vice versa.
We moved the server specific files into their own project which has 1 
file per server with all the right JNDI for that server.


If you want to make a new server configuration, you just make a new 
server configuration file that you deploy to the Tomcat configuration 
directory.
Developers do not have to worry about building server specific WAR files 
with lots of dancing to get the right setup in the right WAR file or 
worrying about deploying the right combination of WAR files.


Reduced our silly deployment errors.

Ron


To suggest some options for the original poster:
   There are several different options to choose which configuration gets used 
or included in a application package.  One way, which I have used a fair 
amount, is to include all configurations, and have an environment variable that 
you set when you run that app that causes it to choose the right file.  The 
exact method of doing this depends on exactly how your configuration is stored, 
but it might consist of things like having property references in spring config 
files, tomcat setenv.sh scripts that pass appropriate java options, or custom 
java code within your app that looks for the variable settings.

On the other hand, if you want actual, separate application packages, each that only 
contains a single set of configuration options, well then you're back in the realm of how 
to get maven to do that for you.  What I've done for this is use profiles with embedded 
ant tasks that copy the appropriate files into place.  Then to build a dev environment 
you might do something like "mvn -P dev package".  Of course, you can use any 
other plugin config within a profile other than the ant plugin, such as having separate 
assembler plugin configs and include different configuration files that way.
There's lots of way to do it; I'm not sure what the best one is.

eric


-Original Message-
From: Ron Wheeler [mailto:rwhee...@artifact-software.com]
Sent: Monday, November 22, 2010 1:03 PM
To: users@maven.apache.org
Subject: Re: Multiple packages with different configuration files


JNDI will do the job on Tomcat.

Ron


On 22/11/2010 1:47 PM, Antonio Petrelli wrote:

2010/11/22:

This app need to be packaged with different configuration files (server
names/IP addresses) for Dev/QA/Prod environments.

This kind of info are better put in the server. For example, for
JBoss, you can create a .properties file and put it inside:
/server/

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



RE: Multiple packages with different configuration files

2010-11-22 Thread Haszlakiewicz, Eric

Well those are some rather useless answers.
JNDI will only "do the job" if you configure it that way.  You need to get that 
configuration *into* tomcat somehow in the first place, regardless of whether 
you use JNDI or a properties file.

To suggest some options for the original poster:
  There are several different options to choose which configuration gets used 
or included in a application package.  One way, which I have used a fair 
amount, is to include all configurations, and have an environment variable that 
you set when you run that app that causes it to choose the right file.  The 
exact method of doing this depends on exactly how your configuration is stored, 
but it might consist of things like having property references in spring config 
files, tomcat setenv.sh scripts that pass appropriate java options, or custom 
java code within your app that looks for the variable settings.

On the other hand, if you want actual, separate application packages, each that 
only contains a single set of configuration options, well then you're back in 
the realm of how to get maven to do that for you.  What I've done for this is 
use profiles with embedded ant tasks that copy the appropriate files into 
place.  Then to build a dev environment you might do something like "mvn -P dev 
package".  Of course, you can use any other plugin config within a profile 
other than the ant plugin, such as having separate assembler plugin configs and 
include different configuration files that way.
There's lots of way to do it; I'm not sure what the best one is.

eric

>-Original Message-
>From: Ron Wheeler [mailto:rwhee...@artifact-software.com]
>Sent: Monday, November 22, 2010 1:03 PM
>To: users@maven.apache.org
>Subject: Re: Multiple packages with different configuration files
>
>
>JNDI will do the job on Tomcat.
>
>Ron
>
>
>On 22/11/2010 1:47 PM, Antonio Petrelli wrote:
>> 2010/11/22:
>>> This app need to be packaged with different configuration files (server
>>> names/IP addresses) for Dev/QA/Prod environments.
>> This kind of info are better put in the server. For example, for
>> JBoss, you can create a .properties file and put it inside:
>> /server/> Everything in the conf directory is available in your classpath.
>>
>> Antonio
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>>
>>
>
>
>-
>To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>For additional commands, e-mail: users-h...@maven.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Multiple packages with different configuration files

2010-11-22 Thread Ron Wheeler


JNDI will do the job on Tomcat.

Ron


On 22/11/2010 1:47 PM, Antonio Petrelli wrote:

2010/11/22:

This app need to be packaged with different configuration files (server
names/IP addresses) for Dev/QA/Prod environments.

This kind of info are better put in the server. For example, for
JBoss, you can create a .properties file and put it inside:
/server/


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Multiple packages with different configuration files

2010-11-22 Thread Antonio Petrelli
2010/11/22  :
> This app need to be packaged with different configuration files (server
> names/IP addresses) for Dev/QA/Prod environments.

This kind of info are better put in the server. For example, for
JBoss, you can create a .properties file and put it inside:
/server/