maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Casey <jdca...@commonjava.org>
Subject Re: Build process for different environments
Date Wed, 14 Sep 2005 14:15:04 GMT
-----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


Mime
View raw message