You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Daniel Serodio (lists)" <da...@xxx.com.br> on 2011/07/25 22:13:59 UTC

Should I use classifiers to differentiate between "devel" and "production" builds?

We have two sets of (database and logging) settings, for development and 
productions builds. We're using "dev" and "prod" profiles to choose the 
appropriate settings for each environment.

Do you think using a classifier to differentiate artifacts built for 
development and production is "hacky", is is this an appropriate solution?

Thanks in advance,
Daniel Serodio

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


Re: Should I use classifiers to differentiate between "devel" and "production" builds?

Posted by Anders Hammar <an...@hammar.net>.
It's bad. Your builds should be environment neutral. Try to get the
configuration outside of the binary.

Also, please search the archive on this topic as it has been discussed
several times already this year.

/Anders

On Mon, Jul 25, 2011 at 22:13, Daniel Serodio (lists) <
daniel.listas@xxx.com.br> wrote:

> We have two sets of (database and logging) settings, for development and
> productions builds. We're using "dev" and "prod" profiles to choose the
> appropriate settings for each environment.
>
> Do you think using a classifier to differentiate artifacts built for
> development and production is "hacky", is is this an appropriate solution?
>
> Thanks in advance,
> Daniel Serodio
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Should I use classifiers to differentiate between "devel" and "production" builds?

Posted by Marcin Kuthan <ma...@gmail.com>.
You are right, not everything could be configured in JNDI. The logger
is a good example. For web application packaged as WAR, you can define
separate project module, and apply the overlay with logger
configuration.

<!-- Customize artifact before deployment -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
        <overlays>
                <overlay>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>modular-war-webapp</artifactId>
                </overlay>
        </overlays>
</configuration>
</plugin>

For more complete example, please look into
http://code.google.com/p/m4enterprise/source/browse/trunk/modular-war/modular-war-deploy/pom.xml

Not ideal, but much better than profiles in the web application
module. The deployment specific configuration is located in separate
"deploy" module.

--
Marcin Kuthan
Maven For Enterprise - http://code.google.com/p/m4enterprise/


On 27 July 2011 15:43, Daniel Serodio (lists) <da...@xxx.com.br> wrote:
> Ansgar Konermann wrote:
>>
>> Am 25.07.2011 22:13, schrieb Daniel Serodio (lists):
>>>
>>> Do you think using a classifier to differentiate artifacts built for
>>> development and production is "hacky", is is this an appropriate
>>> solution?
>>
>> Use the same *artifacts* for all stages and allow for *configuring* the
>> relevant properties of your application at runtime/startup time, as much
>> as possible.
>>
>> A common mechanism to configure things at runtime is using JNDI
>> parameters.
>
> I'mconsidering changing our build process. Setting up the DB using JNDI is
> easy enough, but how do you suggest we deal with different logging
> configurations, which differ not only on some values, but structure (ie
> log4j Loggers and Appenders with different classes, file paths and severity
> thresholds) ?
>
> Regards,
> Daniel Serodio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: Should I use classifiers to differentiate between "devel" and "production" builds?

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 27/07/2011 9:43 AM, Daniel Serodio (lists) wrote:
> Ansgar Konermann wrote:
>> Am 25.07.2011 22:13, schrieb Daniel Serodio (lists):
>>> Do you think using a classifier to differentiate artifacts built for
>>> development and production is "hacky", is is this an appropriate
>>> solution?
>>
>> Use the same *artifacts* for all stages and allow for *configuring* the
>> relevant properties of your application at runtime/startup time, as much
>> as possible.
>>
>> A common mechanism to configure things at runtime is using JNDI 
>> parameters.
> I'mconsidering changing our build process. Setting up the DB using 
> JNDI is easy enough, but how do you suggest we deal with different 
> logging configurations, which differ not only on some values, but 
> structure (ie log4j Loggers and Appenders with different classes, file 
> paths and severity thresholds) ?
>
In our view, the production logging ( also log4j )  is an operations 
function and not an application development issue and should be fixed 
for all versions running in production and not vary from release to 
release except for major changes where new logs are required or some 
horrible intermittent problem in production where custom logging is 
required.

These are setup as separate projects in our source control (Subversion) 
and are installed as part of the servlet engine configuration by someone 
acting as an Operations system manager.
The test (customer acceptance) server is similar.
Individual test servers (PCs or shared virtual machines) are left to the 
programmers to sort out.

Having the logging and other server dependent configurations treated as 
operational issues makes it less likely that something creeps from a 
developer's environment into production.

We are a small shop so it is more of a question of what hat you are 
wearing when you do something, rather than dedicated jobs but we try to 
be as professional as the bigger shops.
Our customers expect our production servers to run as well as the big 
guys' and our updates to go in cleanly.

I hope that this helps.

Ron
> Regards,
> Daniel Serodio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


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


Re: Should I use classifiers to differentiate between "devel" and "production" builds?

Posted by Jeff Jensen <je...@upstairstechnology.com>.
On Wed, Jul 27, 2011 at 8:43 AM, Daniel Serodio (lists) <
daniel.listas@xxx.com.br> wrote:

> Ansgar Konermann wrote:
>
>> Am 25.07.2011 22:13, schrieb Daniel Serodio (lists):
>>
>>> Do you think using a classifier to differentiate artifacts built for
>>> development and production is "hacky", is is this an appropriate
>>> solution?
>>>
>>
>> Use the same *artifacts* for all stages and allow for *configuring* the
>> relevant properties of your application at runtime/startup time, as much
>> as possible.
>>
>> A common mechanism to configure things at runtime is using JNDI
>> parameters.
>>
> I'mconsidering changing our build process. Setting up the DB using JNDI is
> easy enough, but how do you suggest we deal with different logging
> configurations, which differ not only on some values, but structure (ie
> log4j Loggers and Appenders with different classes, file paths and severity
> thresholds) ?
>
>
Either
 1. Externalize the config file for each environment.
 2. Package all config files for all environments and use an external
indicator (unique per environment) to have the code select the correct one
(e.g. an environment variable).

Have defaults that work for all environments if not found (a good idea is to
have the production configuration the default when not finding the external
file or indicator).

Re: Should I use classifiers to differentiate between "devel" and "production" builds?

Posted by "Daniel Serodio (lists)" <da...@xxx.com.br>.
Ansgar Konermann wrote:
> Am 25.07.2011 22:13, schrieb Daniel Serodio (lists):
>> Do you think using a classifier to differentiate artifacts built for
>> development and production is "hacky", is is this an appropriate
>> solution?
>
> Use the same *artifacts* for all stages and allow for *configuring* the
> relevant properties of your application at runtime/startup time, as much
> as possible.
>
> A common mechanism to configure things at runtime is using JNDI parameters.
I'mconsidering changing our build process. Setting up the DB using JNDI 
is easy enough, but how do you suggest we deal with different logging 
configurations, which differ not only on some values, but structure (ie 
log4j Loggers and Appenders with different classes, file paths and 
severity thresholds) ?

Regards,
Daniel Serodio

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


Re: Should I use classifiers to differentiate between "devel" and "production" builds?

Posted by Ron Wheeler <rw...@artifact-software.com>.
http://blog.artifact-software.com/tech/?p=58
Part of the solution.

Ron

On 25/07/2011 4:25 PM, Ansgar Konermann wrote:
> Am 25.07.2011 22:13, schrieb Daniel Serodio (lists):
>> Do you think using a classifier to differentiate artifacts built for
>> development and production is "hacky", is is this an appropriate
>> solution?
> Use the same *artifacts* for all stages and allow for *configuring* the
> relevant properties of your application at runtime/startup time, as much
> as possible.
>
> A common mechanism to configure things at runtime is using JNDI parameters.
>
> Best regards
>
> Ansgar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


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


Re: Should I use classifiers to differentiate between "devel" and "production" builds?

Posted by Ansgar Konermann <an...@googlemail.com>.
Am 25.07.2011 22:13, schrieb Daniel Serodio (lists):
> Do you think using a classifier to differentiate artifacts built for
> development and production is "hacky", is is this an appropriate
> solution? 

Use the same *artifacts* for all stages and allow for *configuring* the
relevant properties of your application at runtime/startup time, as much
as possible.

A common mechanism to configure things at runtime is using JNDI parameters.

Best regards

Ansgar

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


Re: Should I use classifiers to differentiate between "devel" and "production" builds?

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 25/07/2011 5:10 PM, Anders Hammar wrote:
> What I *think* Wayne is talking about is deploying the environment
> configurations wrapped in jars and deploy them to the repo (you would deploy
> a separate jar for each environment). And then during the actual copy to the
> runtime environment pick the appropriate one (from the repo).
> It does work if you know what you're doing, but I think that configuration
> is handled best outside of the code.
I have no doubt that Wayne's suggestion will work.
It is just a question of best practice vs working.
> /Anders
>
> On Mon, Jul 25, 2011 at 22:37, Ron Wheeler
> <rw...@artifact-software.com>wrote:
>
>> On 25/07/2011 4:27 PM, Wayne Fay wrote:
>>
>>> Do you think using a classifier to differentiate artifacts built for
>>>> development and production is "hacky", is is this an appropriate
>>>> solution?
>>>>
>>> IMHO this is OK and not hacky so long as there are ONLY
>>> configuration/settings files in the jars and not actual binaries that
>>> have configuration wrapped up inside them. I'm not a huge fan of this
>>> approach but accept that it has its place.
>>>
>> Hard to figure where this is a good idea.
>>
>>> But then I have to ask how you're planning on using these artifacts in
>>> your repo. Are you going to modify a pom dependency from "dev" to
>>> "prod" in a product when you want to push it to Prod?
>>>
>> Breaks the "rules" about immutability of artifacts between testing and
>> production deployment.
>>
>>> Wayne
>>>
>>>
>>> ------------------------------**------------------------------**---------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>


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


Re: Should I use classifiers to differentiate between "devel" and "production" builds?

Posted by Wayne Fay <wa...@gmail.com>.
This is exactly what I'm talking about, and its not an uncommon
pattern of use and not (IMO) an anti-pattern or something to be
explicitly avoided, so long as how you then USE those config jars is
thought through. I think it makes some sense in some scenarios but
then I also have to question the practice of deploying Production
config files (with Production passwords in them!?!) to a Maven repo
even if it is only internally-accessible since you may inadvertently
over-share those passwords.

This can be part of the "separate your code and config" practice that
we all generally agree with. Plus your config is backed up and
versioned along with the app in your repo.

Wayne

On Mon, Jul 25, 2011 at 4:10 PM, Anders Hammar <an...@hammar.net> wrote:
> What I *think* Wayne is talking about is deploying the environment
> configurations wrapped in jars and deploy them to the repo (you would deploy
> a separate jar for each environment). And then during the actual copy to the
> runtime environment pick the appropriate one (from the repo).
> It does work if you know what you're doing, but I think that configuration
> is handled best outside of the code.
>
> /Anders
>
> On Mon, Jul 25, 2011 at 22:37, Ron Wheeler
> <rw...@artifact-software.com>wrote:
>
>> On 25/07/2011 4:27 PM, Wayne Fay wrote:
>>
>>> Do you think using a classifier to differentiate artifacts built for
>>>> development and production is "hacky", is is this an appropriate
>>>> solution?
>>>>
>>> IMHO this is OK and not hacky so long as there are ONLY
>>> configuration/settings files in the jars and not actual binaries that
>>> have configuration wrapped up inside them. I'm not a huge fan of this
>>> approach but accept that it has its place.
>>>
>> Hard to figure where this is a good idea.
>>
>>> But then I have to ask how you're planning on using these artifacts in
>>> your repo. Are you going to modify a pom dependency from "dev" to
>>> "prod" in a product when you want to push it to Prod?
>>>
>> Breaks the "rules" about immutability of artifacts between testing and
>> production deployment.
>>
>>> Wayne
>>>
>>>
>>> ------------------------------**------------------------------**---------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>

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


Re: Should I use classifiers to differentiate between "devel" and "production" builds?

Posted by Anders Hammar <an...@hammar.net>.
What I *think* Wayne is talking about is deploying the environment
configurations wrapped in jars and deploy them to the repo (you would deploy
a separate jar for each environment). And then during the actual copy to the
runtime environment pick the appropriate one (from the repo).
It does work if you know what you're doing, but I think that configuration
is handled best outside of the code.

/Anders

On Mon, Jul 25, 2011 at 22:37, Ron Wheeler
<rw...@artifact-software.com>wrote:

> On 25/07/2011 4:27 PM, Wayne Fay wrote:
>
>> Do you think using a classifier to differentiate artifacts built for
>>> development and production is "hacky", is is this an appropriate
>>> solution?
>>>
>> IMHO this is OK and not hacky so long as there are ONLY
>> configuration/settings files in the jars and not actual binaries that
>> have configuration wrapped up inside them. I'm not a huge fan of this
>> approach but accept that it has its place.
>>
> Hard to figure where this is a good idea.
>
>> But then I have to ask how you're planning on using these artifacts in
>> your repo. Are you going to modify a pom dependency from "dev" to
>> "prod" in a product when you want to push it to Prod?
>>
> Breaks the "rules" about immutability of artifacts between testing and
> production deployment.
>
>> Wayne
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Should I use classifiers to differentiate between "devel" and "production" builds?

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 25/07/2011 4:27 PM, Wayne Fay wrote:
>> Do you think using a classifier to differentiate artifacts built for
>> development and production is "hacky", is is this an appropriate solution?
> IMHO this is OK and not hacky so long as there are ONLY
> configuration/settings files in the jars and not actual binaries that
> have configuration wrapped up inside them. I'm not a huge fan of this
> approach but accept that it has its place.
Hard to figure where this is a good idea.
> But then I have to ask how you're planning on using these artifacts in
> your repo. Are you going to modify a pom dependency from "dev" to
> "prod" in a product when you want to push it to Prod?
Breaks the "rules" about immutability of artifacts between testing and 
production deployment.
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


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


Re: Should I use classifiers to differentiate between "devel" and "production" builds?

Posted by Wayne Fay <wa...@gmail.com>.
> Do you think using a classifier to differentiate artifacts built for
> development and production is "hacky", is is this an appropriate solution?

IMHO this is OK and not hacky so long as there are ONLY
configuration/settings files in the jars and not actual binaries that
have configuration wrapped up inside them. I'm not a huge fan of this
approach but accept that it has its place.

But then I have to ask how you're planning on using these artifacts in
your repo. Are you going to modify a pom dependency from "dev" to
"prod" in a product when you want to push it to Prod?

Wayne

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