Hi,

i have the following question:

I have to deliver a package with different configurations for different environments, to make things simple let us talk about a database connection for test, development and production.

So the result of the build will be:

package-1.0-dev.tar.gz
package-1.0-test.tar.gz
package-1.0-prod.tar.gz

so i have discovered the following solutions for this:

Solution 1:

I can use a profiles.xml with different profiles which set a property
which will be used for the package phase.
This will result in the following calls of maven:

mvn -Pdev package
mvn -Ptest package
mvn -Pprod package

The disadvantage of this is that every time we call the package all other things like unit test etc. will run...and of course i have to call mvn three time (manually)...


Solution 2:

I can configure the Maven Assembly Plugin like the following:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.2-beta-3</version>
    <executions>
        <execution>
            <id>db-config-1</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
            <configuration>
                <descriptors>

<descriptor>${basedir}/src/main/assembly/dbconfig.xml</descriptor>
                </descriptors>
                <filters>

<filter>${basedir}/src/main/assembly/filterdb.properties</filter>
                </filters>
                <finalName>${anemone.db.config.name}-test</finalName>
            </configuration>
        </execution>
    ....
  ...


So for every environment which i need i can repeat the execution block with different names or property file etc.

The result of such a configuration is that with a simple:

mvn package

as many packages will be produced as many execution parts are configured, but if i need for example more than three different packages it blow up my pom file with many repetitions...

So my question is: Does exist a better or more elegant solution for this problem ?

Many thanks in advance

Kind regards
Karl Heinz Marbaise
--
SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl Heinz Marbaise        ICQ#: 135949029
Hauptstrasse 177                         USt.IdNr: DE191347579
52146 Würselen                           http://www.soebes.de

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

Reply via email to