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 2008/09/15 12:53:17 UTC

Maven and Configuration packages

Hi there,

i have a working Maven 2 multi module setup, but now i need to create
eight different configuration packages (which are different in
connection information for different database) may be more...
Currently i can configure my database information via profiles and using
-P option to maven call....
e.g.
mvn -Pdenv-oracle ....

But this would result in calling maven for eight or more times....to
create the different package for the different databases and enhance the
profiles file with eight or more configurations...

Does there exist a more simpler way to do such a thing....

Does someone has an idea or hint for me...

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 and Configuration packages

Posted by Jörg Schaible <Jo...@scalaris.com>.
Karl Heinz Marbaise wrote:
> Hi Jörg,
> 
> thanks for answering...
>> 
>> The id of the assembly *is* the classifier ... so how do you
>> create distinct files, if you use always the same assembly?
>> Note, that the result of the assembly *is* already an
>> attached artifact. Simply call "mvn deploy" and you will see
>> which artifact Maven explicitly knows about. Remember, those
>> are the only ones that will be published in the "official" repository
>> making a release.
> Ok. I just do in my pom for the assembly plugin:
> 
> <execution>
> <id>config-1</id>
> <phase>package</phase>
> </goals><goal>single</goal></goals>
> <configuration>
> <descriptors><descriptor>.../assembly/config.xml</descriptor><
> /descriptors> <filters><filter>filterC1.properties</filter></filters>
> <finalName>${basename}-config1</finalName>
> </execution>
> This part i repeat for every config i need where i change only the
> filter file... 

IIRC setting the finalName will only change the name locally in your target directory. If Maven deploys those filed into the repository, they will overwrite themselves, since from Maven's view they are all the same and the artifacts name in the repo is build from the artifactId and the classifier defined in the assembly/config.xml. This also means that performing a release your files are lost after you cleaned out your local build directory. Call "mvn install" and look into your local repo. Will you find all 8 configured files? I bet not.

- Jörg

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


Re: Maven and Configuration packages

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi Jörg,

first of all thanks for answering...

> Handle all of them with an own classifier. 
> Then all you need is 8 assembly files (and have a look
> at the docs, you can share the most
> part of those assembly files also) and 8 filter
> files (in one Maven project). Configure 8 executions
> for the assembly plugin.
I have created simply an assembly configuration and call it eight times
with different filter configuration from the pom....
That will produce exactly eight different files as i expected...

May be the classifier do have advantages, but i don't see them....Can
you give me hint what the advantage is ?

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 and Configuration packages

Posted by Jörg Schaible <Jo...@scalaris.com>.
Karl Heinz Marbaise wrote:
> Hi Brett,
> 
> first of all thanks for answering...
> 
>> If possible, it's recommended to keep the database information
>> outside of the artifact to avoid this complication.
> May be i was a little bit unclear...
> I have artifacts which can be distributed stand-alone, but my problem
> currently is to create eight or more packages (which comprises only of
> one or two configuration files) which are used to configure the
> application (with db connection, username etc. and port for the
> application)... 
> 
> So my thoughts are going this way either to create a stand-alone
> mvn-module which contains only those configuration file and will be
> configured by the profile (mvn -P env-1, mvn -P env-2 ...)..
> So this would reduce the packaging to that single module...
> 
> But does exist a better way to create such a bunch of files which only
> differ in some values within...usualy i would create such files and
> using the filtering mechanism....
> 
> I don't want to hard code the eight configuration files and simply
> create them via assembly plugin....

Handle all of them with an own classifier. Then all you need is 8 assembly files (and have a look at the docs, you can share the most part of those assembly files also) and 8 filter files (in one Maven project). Configure 8 executions for the assembly plugin.

- Jörg

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


Re: Maven and Configuration packages

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi Brett,

first of all thanks for answering...

> If possible, it's recommended to keep the database information outside
> of the artifact to avoid this complication.
May be i was a little bit unclear...
I have artifacts which can be distributed stand-alone, but my problem
currently is to create eight or more packages (which comprises only of
one or two configuration files) which are used to configure the
application (with db connection, username etc. and port for the
application)...

So my thoughts are going this way either to create a stand-alone
mvn-module which contains only those configuration file and will be
configured by the profile (mvn -P env-1, mvn -P env-2 ...)..
So this would reduce the packaging to that single module...

But does exist a better way to create such a bunch of files which only
differ in some values within...usualy i would create such files and
using the filtering mechanism....

I don't want to hard code the eight configuration files and simply
create them via assembly plugin....

Kind regards
Karl Heinz Marbaise
> 
> Another alternative is to reprocess the original artifact to add the
> database configuration and attach them during the build, rather than
> building the whole project 8 times.
> 
> If you need to build the project entirely to achieve what you are doing,
> you might consider a multi-module project that produces the different
> alternatives sharing the common information.
> 
> Both of these alternatives tend to end up more complicated than the
> original however.
> 
> Cheers,
> Brett
> 
> 2008/9/15 Karl Heinz Marbaise <khmarbaise@gmx.de <ma...@gmx.de>>
> 
>     Hi there,
> 
>     i have a working Maven 2 multi module setup, but now i need to create
>     eight different configuration packages (which are different in
>     connection information for different database) may be more...
>     Currently i can configure my database information via profiles and using
>     -P option to maven call....
>     e.g.
>     mvn -Pdenv-oracle ....
> 
>     But this would result in calling maven for eight or more times....to
>     create the different package for the different databases and enhance the
>     profiles file with eight or more configurations...
> 
>     Does there exist a more simpler way to do such a thing....
> 
>     Does someone has an idea or hint for me...
> 
>     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
>     <ma...@maven.apache.org>
>     For additional commands, e-mail: users-help@maven.apache.org
>     <ma...@maven.apache.org>
> 
> 
> 
> 
> -- 
> Brett Porter
> Blog: http://blogs.exist.com/bporter/


-- 
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 and Configuration packages

Posted by Brett Porter <br...@gmail.com>.
If possible, it's recommended to keep the database information outside of
the artifact to avoid this complication.
Another alternative is to reprocess the original artifact to add the
database configuration and attach them during the build, rather than
building the whole project 8 times.

If you need to build the project entirely to achieve what you are doing, you
might consider a multi-module project that produces the different
alternatives sharing the common information.

Both of these alternatives tend to end up more complicated than the original
however.

Cheers,
Brett

2008/9/15 Karl Heinz Marbaise <kh...@gmx.de>

> Hi there,
>
> i have a working Maven 2 multi module setup, but now i need to create
> eight different configuration packages (which are different in
> connection information for different database) may be more...
> Currently i can configure my database information via profiles and using
> -P option to maven call....
> e.g.
> mvn -Pdenv-oracle ....
>
> But this would result in calling maven for eight or more times....to
> create the different package for the different databases and enhance the
> profiles file with eight or more configurations...
>
> Does there exist a more simpler way to do such a thing....
>
> Does someone has an idea or hint for me...
>
> 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
>
>


-- 
Brett Porter
Blog: http://blogs.exist.com/bporter/