You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by ma...@merkur.at on 2005/09/14 14:02:20 UTC

Build process for different environments

Hi,

I'm a maven newbie and I try out maven 2.0 alpha 3.

My questions:

I have a project to build / deploy for three different enviroments (test, 
integration, production).

The difference beetween the bundles is only a properties file (there are 
three different files: config-test.properties, 
config-integration.properties ...).
In the build process I want to copy the right config file to a file with a 
common name (config.properties -> the app should work with this config 
file)

Is there a solution to handle this with maven 2 or do I have to write a 
plugin?



TIA

Regards,

Martin




++++++++++++++++++++++++++++++++++++++++++++++
Diese Nachricht ist vertraulich und ausschließlich für den/die Adressaten 
bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner 
Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der 
Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des 
Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den 
Absender umgehend zu benachrichtigen und die Nachricht zu vernichten. 
Elektronisch versandte Nachrichten können durch Unberechtigte manipuliert 
und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen 
wird.
++++++++++++++++++++++++++++++++++++++++++++++
This communication is confidential and is intended solely for the 
addressee(s). If you are not the intended recipient(s), his/her assistant, 
or authorized recipient, any form of disclosure, reproduction, 
distribution or any use of this communication or the information in it, is 
strictly prohibited and may be unlawful. In this case, please notify the 
sender immediately and destroy the e-mail. Electronic communication via 
the Internet by e-mail may be manipulated and/or read by third parties, 
thus we exclude any liability whatsoever for this e-mail.
++++++++++++++++++++++++++++++++++++++++++++++

Re: Build process for different environments

Posted by Emmanuel Venisse <em...@venisse.net>.

Siegfried Goeschl wrote:
> Hi Martin,
> 
> I'm not sure if you should use maven 2.0 alpha 3 as maven newbie for 
> production but this is a strictly personal opinion .... :-)

it isn't my opinion ;-)

> 
> For Maven 1.x you define a <preGoal> or <postGoal> and copy the file around
> 
> Cheers,
> 
> Siegfried Goeschl
> 
> 
> 
> martin.kuhn@merkur.at wrote:
> 
>> Hi,
>>
>> I'm a maven newbie and I try out maven 2.0 alpha 3.
>>
>> My questions:
>>
>> I have a project to build / deploy for three different enviroments 
>> (test, integration, production).
>>
>> The difference beetween the bundles is only a properties file (there 
>> are three different files: config-test.properties, 
>> config-integration.properties ...).
>> In the build process I want to copy the right config file to a file 
>> with a common name (config.properties -> the app should work with this 
>> config file)
>>
>> Is there a solution to handle this with maven 2 or do I have to write 
>> a plugin?
>>
>>
>>
>> TIA
>>
>> Regards,
>>
>> Martin
>>
>>
>>
>>
>> ++++++++++++++++++++++++++++++++++++++++++++++
>> Diese Nachricht ist vertraulich und ausschließlich für den/die 
>> Adressaten bestimmt. Sollten Sie nicht der beabsichtigte Adressat, 
>> einer seiner Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist 
>> jede Form der Kenntnisnahme, Veröffentlichung, Vervielfältigung oder 
>> Weitergabe des Inhalts dieser Nachricht unzulässig. In diesem Fall 
>> bitten wir, den Absender umgehend zu benachrichtigen und die Nachricht 
>> zu vernichten. Elektronisch versandte Nachrichten können durch 
>> Unberechtigte manipuliert und/oder gelesen werden, weshalb jegliche 
>> Haftung hierfür ausgeschlossen wird.
>> ++++++++++++++++++++++++++++++++++++++++++++++
>> This communication is confidential and is intended solely for the 
>> addressee(s). If you are not the intended recipient(s), his/her 
>> assistant, or authorized recipient, any form of disclosure, 
>> reproduction, distribution or any use of this communication or the 
>> information in it, is strictly prohibited and may be unlawful. In this 
>> case, please notify the sender immediately and destroy the e-mail. 
>> Electronic communication via the Internet by e-mail may be manipulated 
>> and/or read by third parties, thus we exclude any liability whatsoever 
>> for this e-mail.
>> ++++++++++++++++++++++++++++++++++++++++++++++
>>  
>>
> 
> 
> ---------------------------------------------------------------------
> 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: Re: Build process for different environments

Posted by ma...@merkur.at.
Hi Siegfried,

maybe you are right.

But I'm in the "try out phase"... 

When I really start with maven I don't want to set up the whole thing with 
a maven version which is not compatible to the new one.

Regards, 

Martin Kuhn






Siegfried Goeschl <si...@it20one.at>
14.09.2005 14:47
Bitte antworten an "Maven Users List"
 
        An:     Maven Users List <us...@maven.apache.org>
        Kopie: 
        Thema:  Re: Build process for different environments


Hi Martin,

I'm not sure if you should use maven 2.0 alpha 3 as maven newbie for 
production but this is a strictly personal opinion .... :-)

For Maven 1.x you define a <preGoal> or <postGoal> and copy the file 
around

Cheers,

Siegfried Goeschl



martin.kuhn@merkur.at wrote:

>Hi,
>
>I'm a maven newbie and I try out maven 2.0 alpha 3.
>
>My questions:
>
>I have a project to build / deploy for three different enviroments (test, 

>integration, production).
>
>The difference beetween the bundles is only a properties file (there are 
>three different files: config-test.properties, 
>config-integration.properties ...).
>In the build process I want to copy the right config file to a file with 
a 
>common name (config.properties -> the app should work with this config 
>file)
>
>Is there a solution to handle this with maven 2 or do I have to write a 
>plugin?
>
>
>
>TIA
>
>Regards,
>
>Martin
>
>
>
>
>++++++++++++++++++++++++++++++++++++++++++++++
>Diese Nachricht ist vertraulich und ausschließlich für den/die Adressaten 

>bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner 
>Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der 
>Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des 
>Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den 
>Absender umgehend zu benachrichtigen und die Nachricht zu vernichten. 
>Elektronisch versandte Nachrichten können durch Unberechtigte manipuliert 

>und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen 
>wird.
>++++++++++++++++++++++++++++++++++++++++++++++
>This communication is confidential and is intended solely for the 
>addressee(s). If you are not the intended recipient(s), his/her 
assistant, 
>or authorized recipient, any form of disclosure, reproduction, 
>distribution or any use of this communication or the information in it, 
is 
>strictly prohibited and may be unlawful. In this case, please notify the 
>sender immediately and destroy the e-mail. Electronic communication via 
>the Internet by e-mail may be manipulated and/or read by third parties, 
>thus we exclude any liability whatsoever for this e-mail.
>++++++++++++++++++++++++++++++++++++++++++++++
> 
>


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







++++++++++++++++++++++++++++++++++++++++++++++
Diese Nachricht ist vertraulich und ausschließlich für den/die Adressaten 
bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner 
Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der 
Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des 
Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den 
Absender umgehend zu benachrichtigen und die Nachricht zu vernichten. 
Elektronisch versandte Nachrichten können durch Unberechtigte manipuliert 
und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen 
wird.
++++++++++++++++++++++++++++++++++++++++++++++
This communication is confidential and is intended solely for the 
addressee(s). If you are not the intended recipient(s), his/her assistant, 
or authorized recipient, any form of disclosure, reproduction, 
distribution or any use of this communication or the information in it, is 
strictly prohibited and may be unlawful. In this case, please notify the 
sender immediately and destroy the e-mail. Electronic communication via 
the Internet by e-mail may be manipulated and/or read by third parties, 
thus we exclude any liability whatsoever for this e-mail.
++++++++++++++++++++++++++++++++++++++++++++++

Re: Build process for different environments

Posted by Siegfried Goeschl <si...@it20one.at>.
Hi Martin,

I'm not sure if you should use maven 2.0 alpha 3 as maven newbie for 
production but this is a strictly personal opinion .... :-)

For Maven 1.x you define a <preGoal> or <postGoal> and copy the file around

Cheers,

Siegfried Goeschl



martin.kuhn@merkur.at wrote:

>Hi,
>
>I'm a maven newbie and I try out maven 2.0 alpha 3.
>
>My questions:
>
>I have a project to build / deploy for three different enviroments (test, 
>integration, production).
>
>The difference beetween the bundles is only a properties file (there are 
>three different files: config-test.properties, 
>config-integration.properties ...).
>In the build process I want to copy the right config file to a file with a 
>common name (config.properties -> the app should work with this config 
>file)
>
>Is there a solution to handle this with maven 2 or do I have to write a 
>plugin?
>
>
>
>TIA
>
>Regards,
>
>Martin
>
>
>
>
>++++++++++++++++++++++++++++++++++++++++++++++
>Diese Nachricht ist vertraulich und ausschließlich für den/die Adressaten 
>bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner 
>Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der 
>Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des 
>Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den 
>Absender umgehend zu benachrichtigen und die Nachricht zu vernichten. 
>Elektronisch versandte Nachrichten können durch Unberechtigte manipuliert 
>und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen 
>wird.
>++++++++++++++++++++++++++++++++++++++++++++++
>This communication is confidential and is intended solely for the 
>addressee(s). If you are not the intended recipient(s), his/her assistant, 
>or authorized recipient, any form of disclosure, reproduction, 
>distribution or any use of this communication or the information in it, is 
>strictly prohibited and may be unlawful. In this case, please notify the 
>sender immediately and destroy the e-mail. Electronic communication via 
>the Internet by e-mail may be manipulated and/or read by third parties, 
>thus we exclude any liability whatsoever for this e-mail.
>++++++++++++++++++++++++++++++++++++++++++++++
>  
>


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


Re: Build process for different environments

Posted by Emmanuel Venisse <em...@venisse.net>.
it's possible to do it with m2 beta-1 and profiles.

you declare profile in your pom like this :

   <profiles>
     <profile>
       <id>env-test</id>
       <activation>
         <property>
           <name>env</name>
           <value>test</value>
         </property>
       </activation>
       <properties>
         <appProperties>test.properties</appProperties>
       </properties>
     </profile>
     <profile>
       <id>env-production</id>
       <activation>
         <property>
           <name>env</name>
           <value>production</value>
         </property>
       </activation>
       <properties>
         <appProperties>app.properties</appProperties>
       </properties>
     </profile>
   </profiles>

and you can run m2 with one of profiles like :
m2 -P env-production clean:clean install ==> we use the profile id
or
m2 -Denv=test clean:clean install ==> we use the property env define in 
<activation>

Emmanuel

martin.kuhn@merkur.at wrote:
> Hi,
> 
> I'm a maven newbie and I try out maven 2.0 alpha 3.
> 
> My questions:
> 
> I have a project to build / deploy for three different enviroments (test, 
> integration, production).
> 
> The difference beetween the bundles is only a properties file (there are 
> three different files: config-test.properties, 
> config-integration.properties ...).
> In the build process I want to copy the right config file to a file with a 
> common name (config.properties -> the app should work with this config 
> file)
> 
> Is there a solution to handle this with maven 2 or do I have to write a 
> plugin?
> 
> 
> 
> TIA
> 
> Regards,
> 
> Martin
> 
> 
> 
> 
> ++++++++++++++++++++++++++++++++++++++++++++++
> Diese Nachricht ist vertraulich und ausschließlich für den/die Adressaten 
> bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner 
> Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der 
> Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des 
> Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den 
> Absender umgehend zu benachrichtigen und die Nachricht zu vernichten. 
> Elektronisch versandte Nachrichten können durch Unberechtigte manipuliert 
> und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen 
> wird.
> ++++++++++++++++++++++++++++++++++++++++++++++
> This communication is confidential and is intended solely for the 
> addressee(s). If you are not the intended recipient(s), his/her assistant, 
> or authorized recipient, any form of disclosure, reproduction, 
> distribution or any use of this communication or the information in it, is 
> strictly prohibited and may be unlawful. In this case, please notify the 
> sender immediately and destroy the e-mail. Electronic communication via 
> the Internet by e-mail may be manipulated and/or read by third parties, 
> thus we exclude any liability whatsoever for this e-mail.
> ++++++++++++++++++++++++++++++++++++++++++++++


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


Re: Re: Build process for different environments

Posted by ma...@merkur.at.
Specifying the name via <finalName> effects only the jar file in target 
directory. In the repository the file has not the "finalName".
Also the file name doesn't include version information.








Mark Hobson <ma...@gmail.com>
15.09.2005 13:22
Bitte antworten an "Maven Users List"
 
        An:     Maven Users List <us...@maven.apache.org>
        Kopie: 
        Thema:  Re: Re: Build process for different environments


On 15/09/05, martin.kuhn@merkur.at <ma...@merkur.at> wrote:
> Thanks, it the meantime I had the same idea.
> 
> Do you have an advice to achieve the right naming for the jar file? (for
> example  domain-prod.jar, domain-test.jar and so on.)

You can use the <finalName> element in profile/build to customise the
final jar name - although not too sure how this would work if the jar
was a dependency of another maven project.

I use profile resources in the same way for one of my projects,
although to avoid duplicates of all resources between profiles I keep
common resources in src/main/resources, and then profile-specific
resources in src/profile/xxx/resources.  This does have the drawback
of having respecify the two resource dirs (common and profile) in all
profiles, which led me to raise
http://jira.codehaus.org/browse/MNG-895.

Does anyone have any suggestions to allow inheritence of resource dirs
from within a profile for these scenarios?

Cheers,

Mark

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







++++++++++++++++++++++++++++++++++++++++++++++
Diese Nachricht ist vertraulich und ausschließlich für den/die Adressaten 
bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner 
Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der 
Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des 
Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den 
Absender umgehend zu benachrichtigen und die Nachricht zu vernichten. 
Elektronisch versandte Nachrichten können durch Unberechtigte manipuliert 
und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen 
wird.
++++++++++++++++++++++++++++++++++++++++++++++
This communication is confidential and is intended solely for the 
addressee(s). If you are not the intended recipient(s), his/her assistant, 
or authorized recipient, any form of disclosure, reproduction, 
distribution or any use of this communication or the information in it, is 
strictly prohibited and may be unlawful. In this case, please notify the 
sender immediately and destroy the e-mail. Electronic communication via 
the Internet by e-mail may be manipulated and/or read by third parties, 
thus we exclude any liability whatsoever for this e-mail.
++++++++++++++++++++++++++++++++++++++++++++++

Re: Re: Build process for different environments

Posted by Mark Hobson <ma...@gmail.com>.
On 15/09/05, martin.kuhn@merkur.at <ma...@merkur.at> wrote:
> Thanks, it the meantime I had the same idea.
> 
> Do you have an advice to achieve the right naming for the jar file? (for
> example  domain-prod.jar, domain-test.jar and so on.)

You can use the <finalName> element in profile/build to customise the
final jar name - although not too sure how this would work if the jar
was a dependency of another maven project.

I use profile resources in the same way for one of my projects,
although to avoid duplicates of all resources between profiles I keep
common resources in src/main/resources, and then profile-specific
resources in src/profile/xxx/resources.  This does have the drawback
of having respecify the two resource dirs (common and profile) in all
profiles, which led me to raise
http://jira.codehaus.org/browse/MNG-895.

Does anyone have any suggestions to allow inheritence of resource dirs
from within a profile for these scenarios?

Cheers,

Mark

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


Re: Re: Build process for different environments

Posted by ma...@merkur.at.
Thanks, it the meantime I had the same idea.

Do you have an advice to achieve the right naming for the jar file? (for 
example  domain-prod.jar, domain-test.jar and so on.)

TIA

Martin





Emmanuel Venisse <em...@venisse.net>
15.09.2005 11:53
Bitte antworten an "Maven Users List"
 
        An:     Maven Users List <us...@maven.apache.org>
        Kopie: 
        Thema:  Re: Build process for different environments




martin.kuhn@merkur.at wrote:
> Thanks for answering,
> 
> when I understand it right there is a properties file with a different 
> name in the build dependent on the enviroment value.
> 
> But when I load the properties file in java I use a defined name 
> (config.properties instead of prod-config.properties, 
> test-config.properties ...) 

if you want the same name file for all your environment, you need to use 
different resources directories

<project>
~  ...
~  <profiles>
~    <profile>
~      <id>env-test</id>

~      <activation>
~        <property>
~          <name>env</name>
~          <value>test</value>
~        </property>
~      </activation>

~      <build>
~        <resources>
~          <resource>
~            <directory>src/main/resources-test</directory>
~          </resource>
~        </resources>
~      </build>
~    </profile>

~    <profile>
~      <id>env-prod</id>

~      <activation>
~        <property>
~          <name>env</name>
~          <value>production</value>
~        </property>
~      </activation>

~      <build>
~        <resources>
~          <resource>
~            <directory>src/main/resources-prod</directory>
~          </resource>
~        </resources>
~      </build>
~    </profile>

~    <profile>
~      <id>env-dev</id>

~      <activation>
~        <activeByDefault>true</activeByDefault>
~      </activation>

~      <build>
~        <resources>
~          <resource>
~            <directory>src/main/resources-dev</directory>
~          </resource>
~        </resources>
~      </build>
~    </profile>
~  </profiles>
</project>

Emmanuel

> 
> So, where does the magic happens to copy for instance 
> prod-config.properties to config.properties.
> 
> Also, it would be nice to get an archive with the name 
artifactid-prod.jar 
> and so on. 
> 
> 
> Martin
> 
> 
> 
> 
> 
> 
> John Casey <jd...@commonjava.org>
> 14.09.2005 16:15
> Bitte antworten an "Maven Users List"
> 
>         An:     Maven Users List <us...@maven.apache.org>
>         Kopie: 
>         Thema:  Re: Build process for different environments
> 
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> First, you'd be well-served to use the svn trunk version for this type
> of problem, since you'll have better help for the second thing, which 
is:
> 
> Use profiles.
> 
> Inside your pom.xml, you could add the following:
> 
> <project>
> ~  ...
> ~  <profiles>
> ~    <profile>
> ~      <id>env-test</id>
> 
> ~      <activation>
> ~        <property>
> ~          <name>env</name>
> ~          <value>test</value>
> ~        </property>
> ~      </activation>
> 
> ~      <build>
> ~        <resources>
> ~          <resource>config-test.properties</resource>
> ~        </resources>
> ~      </build>
> ~    </profile>
> 
> ~    <profile>
> ~      <id>env-prod</id>
> 
> ~      <activation>
> ~        <property>
> ~          <name>env</name>
> ~          <value>production</value>
> ~        </property>
> ~      </activation>
> 
> ~      <build>
> ~        <resources>
> ~          <resource>config-production.properties</resource>
> ~        </resources>
> ~      </build>
> ~    </profile>
> 
> ~    <profile>
> ~      <id>env-dev</id>
> 
> ~      <activation>
> ~        <activeByDefault>true</activeByDefault>
> ~      </activation>
> 
> ~      <build>
> ~        <resources>
> ~          <resource>config-development.properties</resource>
> ~        </resources>
> ~      </build>
> ~    </profile>
> ~  </profiles>
> </project>
> 
> Then, your build will use the development properties by default.
> However, if you specify a command-line option of '-Denv=test' you will
> instead get the test properties...make sense?
> 
> HTH,
> 
> john
> 
> martin.kuhn@merkur.at wrote:
> | Hi,
> |
> | I'm a maven newbie and I try out maven 2.0 alpha 3.
> |
> | My questions:
> |
> | I have a project to build / deploy for three different enviroments 
> (test,
> | integration, production).
> |
> | The difference beetween the bundles is only a properties file (there 
are
> | three different files: config-test.properties,
> | config-integration.properties ...).
> | In the build process I want to copy the right config file to a file
> with a
> | common name (config.properties -> the app should work with this config
> | file)
> |
> | Is there a solution to handle this with maven 2 or do I have to write 
a
> | plugin?
> |
> |
> |
> | TIA
> |
> | Regards,
> |
> | Martin
> |
> |
> |
> |
> | ++++++++++++++++++++++++++++++++++++++++++++++
> | Diese Nachricht ist vertraulich und ausschließlich für den/die 
> Adressaten
> | bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner
> | Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der
> | Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des
> | Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den
> | Absender umgehend zu benachrichtigen und die Nachricht zu vernichten.
> | Elektronisch versandte Nachrichten können durch Unberechtigte 
> manipuliert
> | und/oder gelesen werden, weshalb jegliche Haftung hierfür 
ausgeschlossen
> | wird.
> | ++++++++++++++++++++++++++++++++++++++++++++++
> | This communication is confidential and is intended solely for the
> | addressee(s). If you are not the intended recipient(s), his/her
> assistant,
> | or authorized recipient, any form of disclosure, reproduction,
> | distribution or any use of this communication or the information in
> it, is
> | strictly prohibited and may be unlawful. In this case, please notify 
the
> | sender immediately and destroy the e-mail. Electronic communication 
via
> | the Internet by e-mail may be manipulated and/or read by third 
parties,
> | thus we exclude any liability whatsoever for this e-mail.
> | ++++++++++++++++++++++++++++++++++++++++++++++
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.6 (GNU/Linux)
> 
> iD8DBQFDKDBoK3h2CZwO/4URAs6fAJ98p2x0rPic1EVYkCKeghc0vPzoPQCdEoOn
> oAYxxC5DzJ9hHWPvsRxtNGI=
> =KNob
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> 
> 
> 
> 
> ++++++++++++++++++++++++++++++++++++++++++++++
> Diese Nachricht ist vertraulich und ausschließlich für den/die 
Adressaten 
> bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner 
> Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der 
> Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des 
> Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den 
> Absender umgehend zu benachrichtigen und die Nachricht zu vernichten. 
> Elektronisch versandte Nachrichten können durch Unberechtigte 
manipuliert 
> und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen 

> wird.
> ++++++++++++++++++++++++++++++++++++++++++++++
> This communication is confidential and is intended solely for the 
> addressee(s). If you are not the intended recipient(s), his/her 
assistant, 
> or authorized recipient, any form of disclosure, reproduction, 
> distribution or any use of this communication or the information in it, 
is 
> strictly prohibited and may be unlawful. In this case, please notify the 

> sender immediately and destroy the e-mail. Electronic communication via 
> the Internet by e-mail may be manipulated and/or read by third parties, 
> thus we exclude any liability whatsoever for this e-mail.
> ++++++++++++++++++++++++++++++++++++++++++++++


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







++++++++++++++++++++++++++++++++++++++++++++++
Diese Nachricht ist vertraulich und ausschließlich für den/die Adressaten 
bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner 
Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der 
Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des 
Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den 
Absender umgehend zu benachrichtigen und die Nachricht zu vernichten. 
Elektronisch versandte Nachrichten können durch Unberechtigte manipuliert 
und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen 
wird.
++++++++++++++++++++++++++++++++++++++++++++++
This communication is confidential and is intended solely for the 
addressee(s). If you are not the intended recipient(s), his/her assistant, 
or authorized recipient, any form of disclosure, reproduction, 
distribution or any use of this communication or the information in it, is 
strictly prohibited and may be unlawful. In this case, please notify the 
sender immediately and destroy the e-mail. Electronic communication via 
the Internet by e-mail may be manipulated and/or read by third parties, 
thus we exclude any liability whatsoever for this e-mail.
++++++++++++++++++++++++++++++++++++++++++++++

Re: Build process for different environments

Posted by Emmanuel Venisse <em...@venisse.net>.

martin.kuhn@merkur.at wrote:
> Thanks for answering,
> 
> when I understand it right there is a properties file with a different 
> name in the build dependent on the enviroment value.
> 
> But when I load the properties file in java I use a defined name 
> (config.properties instead of prod-config.properties, 
> test-config.properties ...) 

if you want the same name file for all your environment, you need to use 
different resources directories

<project>
~  ...
~  <profiles>
~    <profile>
~      <id>env-test</id>

~      <activation>
~        <property>
~          <name>env</name>
~          <value>test</value>
~        </property>
~      </activation>

~      <build>
~        <resources>
~          <resource>
~            <directory>src/main/resources-test</directory>
~          </resource>
~        </resources>
~      </build>
~    </profile>

~    <profile>
~      <id>env-prod</id>

~      <activation>
~        <property>
~          <name>env</name>
~          <value>production</value>
~        </property>
~      </activation>

~      <build>
~        <resources>
~          <resource>
~            <directory>src/main/resources-prod</directory>
~          </resource>
~        </resources>
~      </build>
~    </profile>

~    <profile>
~      <id>env-dev</id>

~      <activation>
~        <activeByDefault>true</activeByDefault>
~      </activation>

~      <build>
~        <resources>
~          <resource>
~            <directory>src/main/resources-dev</directory>
~          </resource>
~        </resources>
~      </build>
~    </profile>
~  </profiles>
</project>

Emmanuel

> 
> So, where does the magic happens to copy for instance 
> prod-config.properties to config.properties.
> 
> Also, it would be nice to get an archive with the name artifactid-prod.jar 
> and so on. 
> 
> 
> Martin
> 
> 
> 
> 
> 
> 
> John Casey <jd...@commonjava.org>
> 14.09.2005 16:15
> Bitte antworten an "Maven Users List"
>  
>         An:     Maven Users List <us...@maven.apache.org>
>         Kopie: 
>         Thema:  Re: Build process for different environments
> 
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> First, you'd be well-served to use the svn trunk version for this type
> of problem, since you'll have better help for the second thing, which is:
> 
> Use profiles.
> 
> Inside your pom.xml, you could add the following:
> 
> <project>
> ~  ...
> ~  <profiles>
> ~    <profile>
> ~      <id>env-test</id>
> 
> ~      <activation>
> ~        <property>
> ~          <name>env</name>
> ~          <value>test</value>
> ~        </property>
> ~      </activation>
> 
> ~      <build>
> ~        <resources>
> ~          <resource>config-test.properties</resource>
> ~        </resources>
> ~      </build>
> ~    </profile>
> 
> ~    <profile>
> ~      <id>env-prod</id>
> 
> ~      <activation>
> ~        <property>
> ~          <name>env</name>
> ~          <value>production</value>
> ~        </property>
> ~      </activation>
> 
> ~      <build>
> ~        <resources>
> ~          <resource>config-production.properties</resource>
> ~        </resources>
> ~      </build>
> ~    </profile>
> 
> ~    <profile>
> ~      <id>env-dev</id>
> 
> ~      <activation>
> ~        <activeByDefault>true</activeByDefault>
> ~      </activation>
> 
> ~      <build>
> ~        <resources>
> ~          <resource>config-development.properties</resource>
> ~        </resources>
> ~      </build>
> ~    </profile>
> ~  </profiles>
> </project>
> 
> Then, your build will use the development properties by default.
> However, if you specify a command-line option of '-Denv=test' you will
> instead get the test properties...make sense?
> 
> HTH,
> 
> john
> 
> martin.kuhn@merkur.at wrote:
> | Hi,
> |
> | I'm a maven newbie and I try out maven 2.0 alpha 3.
> |
> | My questions:
> |
> | I have a project to build / deploy for three different enviroments 
> (test,
> | integration, production).
> |
> | The difference beetween the bundles is only a properties file (there are
> | three different files: config-test.properties,
> | config-integration.properties ...).
> | In the build process I want to copy the right config file to a file
> with a
> | common name (config.properties -> the app should work with this config
> | file)
> |
> | Is there a solution to handle this with maven 2 or do I have to write a
> | plugin?
> |
> |
> |
> | TIA
> |
> | Regards,
> |
> | Martin
> |
> |
> |
> |
> | ++++++++++++++++++++++++++++++++++++++++++++++
> | Diese Nachricht ist vertraulich und ausschließlich für den/die 
> Adressaten
> | bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner
> | Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der
> | Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des
> | Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den
> | Absender umgehend zu benachrichtigen und die Nachricht zu vernichten.
> | Elektronisch versandte Nachrichten können durch Unberechtigte 
> manipuliert
> | und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen
> | wird.
> | ++++++++++++++++++++++++++++++++++++++++++++++
> | This communication is confidential and is intended solely for the
> | addressee(s). If you are not the intended recipient(s), his/her
> assistant,
> | or authorized recipient, any form of disclosure, reproduction,
> | distribution or any use of this communication or the information in
> it, is
> | strictly prohibited and may be unlawful. In this case, please notify the
> | sender immediately and destroy the e-mail. Electronic communication via
> | the Internet by e-mail may be manipulated and/or read by third parties,
> | thus we exclude any liability whatsoever for this e-mail.
> | ++++++++++++++++++++++++++++++++++++++++++++++
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.6 (GNU/Linux)
> 
> iD8DBQFDKDBoK3h2CZwO/4URAs6fAJ98p2x0rPic1EVYkCKeghc0vPzoPQCdEoOn
> oAYxxC5DzJ9hHWPvsRxtNGI=
> =KNob
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> 
> 
> 
> 
> ++++++++++++++++++++++++++++++++++++++++++++++
> Diese Nachricht ist vertraulich und ausschließlich für den/die Adressaten 
> bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner 
> Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der 
> Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des 
> Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den 
> Absender umgehend zu benachrichtigen und die Nachricht zu vernichten. 
> Elektronisch versandte Nachrichten können durch Unberechtigte manipuliert 
> und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen 
> wird.
> ++++++++++++++++++++++++++++++++++++++++++++++
> This communication is confidential and is intended solely for the 
> addressee(s). If you are not the intended recipient(s), his/her assistant, 
> or authorized recipient, any form of disclosure, reproduction, 
> distribution or any use of this communication or the information in it, is 
> strictly prohibited and may be unlawful. In this case, please notify the 
> sender immediately and destroy the e-mail. Electronic communication via 
> the Internet by e-mail may be manipulated and/or read by third parties, 
> thus we exclude any liability whatsoever for this e-mail.
> ++++++++++++++++++++++++++++++++++++++++++++++


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


Re: Re: Build process for different environments

Posted by ma...@merkur.at.
Thanks for answering,

when I understand it right there is a properties file with a different 
name in the build dependent on the enviroment value.

But when I load the properties file in java I use a defined name 
(config.properties instead of prod-config.properties, 
test-config.properties ...) 

So, where does the magic happens to copy for instance 
prod-config.properties to config.properties.

Also, it would be nice to get an archive with the name artifactid-prod.jar 
and so on. 


Martin






John Casey <jd...@commonjava.org>
14.09.2005 16:15
Bitte antworten an "Maven Users List"
 
        An:     Maven Users List <us...@maven.apache.org>
        Kopie: 
        Thema:  Re: Build process for different environments


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

First, you'd be well-served to use the svn trunk version for this type
of problem, since you'll have better help for the second thing, which is:

Use profiles.

Inside your pom.xml, you could add the following:

<project>
~  ...
~  <profiles>
~    <profile>
~      <id>env-test</id>

~      <activation>
~        <property>
~          <name>env</name>
~          <value>test</value>
~        </property>
~      </activation>

~      <build>
~        <resources>
~          <resource>config-test.properties</resource>
~        </resources>
~      </build>
~    </profile>

~    <profile>
~      <id>env-prod</id>

~      <activation>
~        <property>
~          <name>env</name>
~          <value>production</value>
~        </property>
~      </activation>

~      <build>
~        <resources>
~          <resource>config-production.properties</resource>
~        </resources>
~      </build>
~    </profile>

~    <profile>
~      <id>env-dev</id>

~      <activation>
~        <activeByDefault>true</activeByDefault>
~      </activation>

~      <build>
~        <resources>
~          <resource>config-development.properties</resource>
~        </resources>
~      </build>
~    </profile>
~  </profiles>
</project>

Then, your build will use the development properties by default.
However, if you specify a command-line option of '-Denv=test' you will
instead get the test properties...make sense?

HTH,

john

martin.kuhn@merkur.at wrote:
| Hi,
|
| I'm a maven newbie and I try out maven 2.0 alpha 3.
|
| My questions:
|
| I have a project to build / deploy for three different enviroments 
(test,
| integration, production).
|
| The difference beetween the bundles is only a properties file (there are
| three different files: config-test.properties,
| config-integration.properties ...).
| In the build process I want to copy the right config file to a file
with a
| common name (config.properties -> the app should work with this config
| file)
|
| Is there a solution to handle this with maven 2 or do I have to write a
| plugin?
|
|
|
| TIA
|
| Regards,
|
| Martin
|
|
|
|
| ++++++++++++++++++++++++++++++++++++++++++++++
| Diese Nachricht ist vertraulich und ausschließlich für den/die 
Adressaten
| bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner
| Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der
| Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des
| Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den
| Absender umgehend zu benachrichtigen und die Nachricht zu vernichten.
| Elektronisch versandte Nachrichten können durch Unberechtigte 
manipuliert
| und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen
| wird.
| ++++++++++++++++++++++++++++++++++++++++++++++
| This communication is confidential and is intended solely for the
| addressee(s). If you are not the intended recipient(s), his/her
assistant,
| or authorized recipient, any form of disclosure, reproduction,
| distribution or any use of this communication or the information in
it, is
| strictly prohibited and may be unlawful. In this case, please notify the
| sender immediately and destroy the e-mail. Electronic communication via
| the Internet by e-mail may be manipulated and/or read by third parties,
| thus we exclude any liability whatsoever for this e-mail.
| ++++++++++++++++++++++++++++++++++++++++++++++
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDKDBoK3h2CZwO/4URAs6fAJ98p2x0rPic1EVYkCKeghc0vPzoPQCdEoOn
oAYxxC5DzJ9hHWPvsRxtNGI=
=KNob
-----END PGP SIGNATURE-----

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







++++++++++++++++++++++++++++++++++++++++++++++
Diese Nachricht ist vertraulich und ausschließlich für den/die Adressaten 
bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner 
Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der 
Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des 
Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den 
Absender umgehend zu benachrichtigen und die Nachricht zu vernichten. 
Elektronisch versandte Nachrichten können durch Unberechtigte manipuliert 
und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen 
wird.
++++++++++++++++++++++++++++++++++++++++++++++
This communication is confidential and is intended solely for the 
addressee(s). If you are not the intended recipient(s), his/her assistant, 
or authorized recipient, any form of disclosure, reproduction, 
distribution or any use of this communication or the information in it, is 
strictly prohibited and may be unlawful. In this case, please notify the 
sender immediately and destroy the e-mail. Electronic communication via 
the Internet by e-mail may be manipulated and/or read by third parties, 
thus we exclude any liability whatsoever for this e-mail.
++++++++++++++++++++++++++++++++++++++++++++++

Re: Build process for different environments

Posted by John Casey <jd...@commonjava.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

First, you'd be well-served to use the svn trunk version for this type
of problem, since you'll have better help for the second thing, which is:

Use profiles.

Inside your pom.xml, you could add the following:

<project>
~  ...
~  <profiles>
~    <profile>
~      <id>env-test</id>

~      <activation>
~        <property>
~          <name>env</name>
~          <value>test</value>
~        </property>
~      </activation>

~      <build>
~        <resources>
~          <resource>config-test.properties</resource>
~        </resources>
~      </build>
~    </profile>

~    <profile>
~      <id>env-prod</id>

~      <activation>
~        <property>
~          <name>env</name>
~          <value>production</value>
~        </property>
~      </activation>

~      <build>
~        <resources>
~          <resource>config-production.properties</resource>
~        </resources>
~      </build>
~    </profile>

~    <profile>
~      <id>env-dev</id>

~      <activation>
~        <activeByDefault>true</activeByDefault>
~      </activation>

~      <build>
~        <resources>
~          <resource>config-development.properties</resource>
~        </resources>
~      </build>
~    </profile>
~  </profiles>
</project>

Then, your build will use the development properties by default.
However, if you specify a command-line option of '-Denv=test' you will
instead get the test properties...make sense?

HTH,

john

martin.kuhn@merkur.at wrote:
| Hi,
|
| I'm a maven newbie and I try out maven 2.0 alpha 3.
|
| My questions:
|
| I have a project to build / deploy for three different enviroments (test,
| integration, production).
|
| The difference beetween the bundles is only a properties file (there are
| three different files: config-test.properties,
| config-integration.properties ...).
| In the build process I want to copy the right config file to a file
with a
| common name (config.properties -> the app should work with this config
| file)
|
| Is there a solution to handle this with maven 2 or do I have to write a
| plugin?
|
|
|
| TIA
|
| Regards,
|
| Martin
|
|
|
|
| ++++++++++++++++++++++++++++++++++++++++++++++
| Diese Nachricht ist vertraulich und ausschließlich für den/die Adressaten
| bestimmt. Sollten Sie nicht der beabsichtigte Adressat, einer seiner
| Mitarbeiter oder sein Empfangsbevollmächtigter sein, ist jede Form der
| Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des
| Inhalts dieser Nachricht unzulässig. In diesem Fall bitten wir, den
| Absender umgehend zu benachrichtigen und die Nachricht zu vernichten.
| Elektronisch versandte Nachrichten können durch Unberechtigte manipuliert
| und/oder gelesen werden, weshalb jegliche Haftung hierfür ausgeschlossen
| wird.
| ++++++++++++++++++++++++++++++++++++++++++++++
| This communication is confidential and is intended solely for the
| addressee(s). If you are not the intended recipient(s), his/her
assistant,
| or authorized recipient, any form of disclosure, reproduction,
| distribution or any use of this communication or the information in
it, is
| strictly prohibited and may be unlawful. In this case, please notify the
| sender immediately and destroy the e-mail. Electronic communication via
| the Internet by e-mail may be manipulated and/or read by third parties,
| thus we exclude any liability whatsoever for this e-mail.
| ++++++++++++++++++++++++++++++++++++++++++++++
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDKDBoK3h2CZwO/4URAs6fAJ98p2x0rPic1EVYkCKeghc0vPzoPQCdEoOn
oAYxxC5DzJ9hHWPvsRxtNGI=
=KNob
-----END PGP SIGNATURE-----

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