You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Karl Heinz Marbaise <kh...@gmx.de> on 2009/10/20 20:39:32 UTC

Maven Assembly PlugIn...Multiple Artifacts with different configurations

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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven Assembly PlugIn...Multiple Artifacts with different configurations

Posted by Stevo Slavić <ss...@gmail.com>.
http://maven.apache.org/plugins/maven-assembly-plugin/examples/single/using-components.html

Regards,
Stevo.

On Tue, Oct 20, 2009 at 8:39 PM, Karl Heinz Marbaise <kh...@gmx.de>wrote:

> 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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>