You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by John Prystash <st...@yahoo.com> on 2009/11/23 16:59:20 UTC
Thoughts on build vs deploy time property filtering
Hi, I was hoping for some thoughts from the community about the reasons behind why one might want to filter at build time versus at deploy time.
Traditionally, our organization built one artifact from version control that still contained property placeholders. We would filter those artifacts at deploy time, so that the artifact was completed as it deployed to the target environment. This was seen as beneficial as we only had to build our artifact once, and then we can deploy that same artifact multiple times.
It appears as though maven prefers to filter at build time, and create a different artifact per environment. What are the benefits of this methodology? It looks like you would have to do multiple builds (to produce an environment-specific artifact), where before, we could only build a filterable artifact once.
Thanks
Re: Thoughts on build vs deploy time property filtering
Posted by John Prystash <st...@yahoo.com>.
Thanks Matt. I'll be sure to bring up this approach as an option.
________________________________
From: Matt Milliss <ma...@gmail.com>
To: Maven Users List <us...@maven.apache.org>
Sent: Mon, November 23, 2009 7:45:03 PM
Subject: Re: Thoughts on build vs deploy time property filtering
To avoid having to build an artifact per environment we took the
approach of having a single build which contains all properties for all
environments, but we use a runtime flag to tell the application which
set of properties to use. So inside the war (or whatever packaging you
use) we have a directory structure something like this,
properties/environment1/foo.properties
properties/environment2/foo.properties
properties/environment3/foo.properties
properties/environment4/foo.properties
properties/environment5/foo.properties
properties/common.properties
and then pass a -Denvironment=environment3 at startup which instructs
our app to use the foo.properties from the environment3 directory. I'm
not sure what technology you are using but we use spring which makes
this type of configuration very easy. We took this approach for
different reasons but it does save all the messing around with either
builds per environment or filtering at deploy time.
Cheers
Matt
On 24/11/09 08:37, John Prystash wrote:
> Before Maven, we used Ant. The build output was a tar.gz that was staged to the install host. A deploy consisted of an unpacking of the .tar.gz and Ant was run given a properties file and an installation directory.
>
> With Maven, our current process is to filter for the target environment at build time, producing an application inside .tar.gz that can be unpacked and started, but that requires one build per environment.
>
>
>
>
> ________________________________
> From: Anders Hammar<an...@hammar.net>
> To: Maven Users List<us...@maven.apache.org>
> Sent: Mon, November 23, 2009 4:06:11 PM
> Subject: Re: Thoughts on build vs deploy time property filtering
>
> Well, I would argue that you should keep all environment specific
> configuration outside of your "artifact".
>
> How can you do filtering on deploy? Do you explode your jar/war/ear, filter,
> and then repack?
>
> /Anders
>
> On Mon, Nov 23, 2009 at 16:59, John Prystash<st...@yahoo.com> wrote:
>
>
>> Hi, I was hoping for some thoughts from the community about the reasons
>> behind why one might want to filter at build time versus at deploy time.
>>
>> Traditionally, our organization built one artifact from version control
>> that still contained property placeholders. We would filter those artifacts
>> at deploy time, so that the artifact was completed as it deployed to the
>> target environment. This was seen as beneficial as we only had to build our
>> artifact once, and then we can deploy that same artifact multiple times.
>>
>> It appears as though maven prefers to filter at build time, and create a
>> different artifact per environment. What are the benefits of this
>> methodology? It looks like you would have to do multiple builds (to produce
>> an environment-specific artifact), where before, we could only build a
>> filterable artifact once.
>>
>> Thanks
>>
>>
>>
>>
>>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Thoughts on build vs deploy time property filtering
Posted by Matt Milliss <ma...@gmail.com>.
To avoid having to build an artifact per environment we took the
approach of having a single build which contains all properties for all
environments, but we use a runtime flag to tell the application which
set of properties to use. So inside the war (or whatever packaging you
use) we have a directory structure something like this,
properties/environment1/foo.properties
properties/environment2/foo.properties
properties/environment3/foo.properties
properties/environment4/foo.properties
properties/environment5/foo.properties
properties/common.properties
and then pass a -Denvironment=environment3 at startup which instructs
our app to use the foo.properties from the environment3 directory. I'm
not sure what technology you are using but we use spring which makes
this type of configuration very easy. We took this approach for
different reasons but it does save all the messing around with either
builds per environment or filtering at deploy time.
Cheers
Matt
On 24/11/09 08:37, John Prystash wrote:
> Before Maven, we used Ant. The build output was a tar.gz that was staged to the install host. A deploy consisted of an unpacking of the .tar.gz and Ant was run given a properties file and an installation directory.
>
> With Maven, our current process is to filter for the target environment at build time, producing an application inside .tar.gz that can be unpacked and started, but that requires one build per environment.
>
>
>
>
> ________________________________
> From: Anders Hammar<an...@hammar.net>
> To: Maven Users List<us...@maven.apache.org>
> Sent: Mon, November 23, 2009 4:06:11 PM
> Subject: Re: Thoughts on build vs deploy time property filtering
>
> Well, I would argue that you should keep all environment specific
> configuration outside of your "artifact".
>
> How can you do filtering on deploy? Do you explode your jar/war/ear, filter,
> and then repack?
>
> /Anders
>
> On Mon, Nov 23, 2009 at 16:59, John Prystash<st...@yahoo.com> wrote:
>
>
>> Hi, I was hoping for some thoughts from the community about the reasons
>> behind why one might want to filter at build time versus at deploy time.
>>
>> Traditionally, our organization built one artifact from version control
>> that still contained property placeholders. We would filter those artifacts
>> at deploy time, so that the artifact was completed as it deployed to the
>> target environment. This was seen as beneficial as we only had to build our
>> artifact once, and then we can deploy that same artifact multiple times.
>>
>> It appears as though maven prefers to filter at build time, and create a
>> different artifact per environment. What are the benefits of this
>> methodology? It looks like you would have to do multiple builds (to produce
>> an environment-specific artifact), where before, we could only build a
>> filterable artifact once.
>>
>> Thanks
>>
>>
>>
>>
>>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Thoughts on build vs deploy time property filtering
Posted by John Prystash <st...@yahoo.com>.
Before Maven, we used Ant. The build output was a tar.gz that was staged to the install host. A deploy consisted of an unpacking of the .tar.gz and Ant was run given a properties file and an installation directory.
With Maven, our current process is to filter for the target environment at build time, producing an application inside .tar.gz that can be unpacked and started, but that requires one build per environment.
________________________________
From: Anders Hammar <an...@hammar.net>
To: Maven Users List <us...@maven.apache.org>
Sent: Mon, November 23, 2009 4:06:11 PM
Subject: Re: Thoughts on build vs deploy time property filtering
Well, I would argue that you should keep all environment specific
configuration outside of your "artifact".
How can you do filtering on deploy? Do you explode your jar/war/ear, filter,
and then repack?
/Anders
On Mon, Nov 23, 2009 at 16:59, John Prystash <st...@yahoo.com> wrote:
> Hi, I was hoping for some thoughts from the community about the reasons
> behind why one might want to filter at build time versus at deploy time.
>
> Traditionally, our organization built one artifact from version control
> that still contained property placeholders. We would filter those artifacts
> at deploy time, so that the artifact was completed as it deployed to the
> target environment. This was seen as beneficial as we only had to build our
> artifact once, and then we can deploy that same artifact multiple times.
>
> It appears as though maven prefers to filter at build time, and create a
> different artifact per environment. What are the benefits of this
> methodology? It looks like you would have to do multiple builds (to produce
> an environment-specific artifact), where before, we could only build a
> filterable artifact once.
>
> Thanks
>
>
>
>
Re: Thoughts on build vs deploy time property filtering
Posted by Anders Hammar <an...@hammar.net>.
Well, I would argue that you should keep all environment specific
configuration outside of your "artifact".
How can you do filtering on deploy? Do you explode your jar/war/ear, filter,
and then repack?
/Anders
On Mon, Nov 23, 2009 at 16:59, John Prystash <st...@yahoo.com> wrote:
> Hi, I was hoping for some thoughts from the community about the reasons
> behind why one might want to filter at build time versus at deploy time.
>
> Traditionally, our organization built one artifact from version control
> that still contained property placeholders. We would filter those artifacts
> at deploy time, so that the artifact was completed as it deployed to the
> target environment. This was seen as beneficial as we only had to build our
> artifact once, and then we can deploy that same artifact multiple times.
>
> It appears as though maven prefers to filter at build time, and create a
> different artifact per environment. What are the benefits of this
> methodology? It looks like you would have to do multiple builds (to produce
> an environment-specific artifact), where before, we could only build a
> filterable artifact once.
>
> Thanks
>
>
>
>