You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ivan <ma...@telemetria.ru> on 2011/07/11 08:47:42 UTC

Multimodule distribution

Hello, guys! 
We have a project consisting of a main module (we call it core) and several
configurable plugin modules (we call it component). By the application
design each module is highly customizable and depends on one or more
configuration files. When the application starts the "conf" folder is
scanned and application configuration is constructed from all conf-files
located in that folder. Depending on the usage scenario several combinations
of configuration files may be used

The basic aim we want to achieve is:
1) Have all possible configuration files stored in some folder of a module,
e.g. for component A we have Aconf1.xml, Aconf2.xml and for component B
Bconf1.xml and Bconf2.xml
2) For each target usage scenario we want to predefine a set of
configuration files in a pom file that will build a distribution. E.g. for
Scenario1 we should use Aconf1.xml and Bconf2.xml, but for Scenario2 we
should use Aconf2.xml and Bconf1.xml
3) The resulting layout should look like ./lib - all *.jar files (core and
components used) and ./conf - subset of configuration files specified in a
distribution pom file.

Can you suggest how this goal can be achieved with maven and distribution or
assembly plugin?

--
View this message in context: http://maven.40175.n5.nabble.com/Multimodule-distribution-tp4574067p4574067.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Multimodule distribution

Posted by Brian Topping <to...@codehaus.org>.
This isn't a Maven thing, but we usually name all our component configuration files the same name in the respective jars.  Spring has a means to find all the files of the same name in the different jars (you can go check it out there, they use the "classpath*:" nomenclature for it).  That way, our component loader just asks for "classpath*:/lib/component.xml" or some such and gets back all the configs for components, regardless of how many there are, avoiding gaps in naming created over time by deprecated components and component names.

The part that *is* a Maven thing with this process is you don't need any complicated assembly config to get the component names worked out in a certain way.  

Hope that helps, B

On Jul 10, 2011, at 11:47 PM, Ivan wrote:

> Hello, guys! 
> We have a project consisting of a main module (we call it core) and several
> configurable plugin modules (we call it component). By the application
> design each module is highly customizable and depends on one or more
> configuration files. When the application starts the "conf" folder is
> scanned and application configuration is constructed from all conf-files
> located in that folder. Depending on the usage scenario several combinations
> of configuration files may be used
> 
> The basic aim we want to achieve is:
> 1) Have all possible configuration files stored in some folder of a module,
> e.g. for component A we have Aconf1.xml, Aconf2.xml and for component B
> Bconf1.xml and Bconf2.xml
> 2) For each target usage scenario we want to predefine a set of
> configuration files in a pom file that will build a distribution. E.g. for
> Scenario1 we should use Aconf1.xml and Bconf2.xml, but for Scenario2 we
> should use Aconf2.xml and Bconf1.xml
> 3) The resulting layout should look like ./lib - all *.jar files (core and
> components used) and ./conf - subset of configuration files specified in a
> distribution pom file.
> 
> Can you suggest how this goal can be achieved with maven and distribution or
> assembly plugin?
> 
> --
> View this message in context: http://maven.40175.n5.nabble.com/Multimodule-distribution-tp4574067p4574067.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> 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: Multimodule distribution

Posted by Ivan <ma...@telemetria.ru>.
Thanks for quick answers! Actually we want the exactly solution you suggest:
one pom - one distribution package. Packing a config in a jar file is not
acceptable because configuration can be altered by the end-user and in case
of component update he will loose all the modifications.

Solution with packages is exactly what we want with one exception: assembly
descriptor should contain not only the component jar, but some configs
out-of-the jar. The actual problem that we cannot solve is: how to publish
several artifacts for a module and during the distribution phase pull the
arbitrary subset of component's artifacts.
i.e. the structure we want to achieve is:
Root 
\---JARS 
|   \---Core 
|   \---Component A (Deps: Core; Aconf1.xml Aconf2.xml) 
|   \---Component B (Deps: Core) 
|   \--- ... 
\---PACKAGES 
     \--- PACKAGE 1 (Deps: Component A (Aconf1.xml), Component B) 
     \--- PACKAGE 2 (Deps: Component A (Aconf2.xml), Component B) 
     \--- ... 
The most close soultion that we saw is to place config files in
main/resources/conf directory and then unpack them from sources with
assembly plugin, but it will unpack the whole dir. Is there a way to filter
files according to rules in a pom? Or probably there is a more clean way to
do it?

--
View this message in context: http://maven.40175.n5.nabble.com/Multimodule-distribution-tp4574067p4575146.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Multimodule distribution

Posted by glenh <gl...@quickplay.com>.
Have you tried using filesets?  You can include/exclude files/directories in
your assembly descriptor.

--
View this message in context: http://maven.40175.n5.nabble.com/Multimodule-distribution-tp4574067p4670472.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Multimodule distribution

Posted by Ivan <ma...@telemetria.ru>.
Thanks for quick answers! Actually we want the exactly solution you suggest:
one pom - one distribution package. Packing a config in a jar file is not
acceptable because configuration can be altered by the end-user and in case
of component update he will loose all the modifications.

Solution with packages is exactly what we want with one exception: assembly
descriptor should contain not only the component jar, but some configs
out-of-the jar. The actual problem that we cannot solve is: how to publish
several artifacts for a module and during the distribution phase pull the
arbitrary subset of component's artifacts.
i.e. the structure we want to achieve is:
Root 
\---JARS 
|   \---Core 
|   \---Component A (Deps: Core; Aconf1.xml Aconf2.xml) 
|   \---Component B (Deps: Core) 
|   \--- ... 
\---PACKAGES 
     \--- PACKAGE 1 (Deps: Component A (Aconf1.xml), Component B) 
     \--- PACKAGE 2 (Deps: Component A (Aconf2.xml), Component B) 
     \--- ... 
The most close soultion that we saw is to place config files in
main/resources/conf directory and then unpack them from sources with
assembly plugin, but it will unpack the whole dir. Is there a way to filter
files according to rules in a pom? Or probably there is a more clean way to
do it?

--
View this message in context: http://maven.40175.n5.nabble.com/Multimodule-distribution-tp4574067p4575148.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Multimodule distribution

Posted by Ron Wheeler <rw...@artifact-software.com>.
Guillaume's suggestion is in line with the "Maven way" of "one pom - one 
product".
If you follow his advice you will not be in a constant battle with Maven.

Once you have you packages set up, they should require little 
maintenance and with good package ids will be easy to document.

Ron


On 11/07/2011 4:49 AM, Guillaume Polet wrote:
> Hi,
>
> I have set up this kind of project by using Multi-module project; 
> packages are built with the assembly plugin. The thing is that I have 
> two main branches in my multi-module project:
> 1) for all the jars of code: this branch configures all the general 
> presets for all jars of the application.
> 2) for all the different packages I want to create: this branch 
> configures all the general presets for all packages I want to have.
>
> The Maven project structure looks like this:
>
> Root
> \---JARS
> |   \---Core
> |   \---Component A (Deps: Core)
> |   \---Component B (Deps: Core)
> |   \--- ...
> \---PACKAGES
>     \--- PACKAGE 1 (Deps: Component A, Component B)
>     \--- PACKAGE 2 (Deps: Component B, Component ...)
>     \--- ...
>
> In the pom of PACKAGES, I have attached the maven assembly plugin to 
> the build process (e.g. attached to the "package" phase).  In each 
> packages, I declare the "correct" dependencies that needs to be 
> embedded in each package. The key for you will be to create a proper 
> assembly descriptor file.
>
> Then if I use ´mvn clean install´ on the root pom and it builds all 
> jars and then all packages. The bonus I get from such configuration is 
> that I can use the "Package" pom's to create "Launch configurations" 
> in development and I am then sure that it matches exactly what will be 
> in each different package.
>
> Guillaume
> Le 11/07/2011 8:47, Ivan a écrit :
>> Hello, guys!
>> We have a project consisting of a main module (we call it core) and 
>> several
>> configurable plugin modules (we call it component). By the application
>> design each module is highly customizable and depends on one or more
>> configuration files. When the application starts the "conf" folder is
>> scanned and application configuration is constructed from all conf-files
>> located in that folder. Depending on the usage scenario several 
>> combinations
>> of configuration files may be used
>>
>> The basic aim we want to achieve is:
>> 1) Have all possible configuration files stored in some folder of a 
>> module,
>> e.g. for component A we have Aconf1.xml, Aconf2.xml and for component B
>> Bconf1.xml and Bconf2.xml
>> 2) For each target usage scenario we want to predefine a set of
>> configuration files in a pom file that will build a distribution. 
>> E.g. for
>> Scenario1 we should use Aconf1.xml and Bconf2.xml, but for Scenario2 we
>> should use Aconf2.xml and Bconf1.xml
>> 3) The resulting layout should look like ./lib - all *.jar files 
>> (core and
>> components used) and ./conf - subset of configuration files specified 
>> in a
>> distribution pom file.
>>
>> Can you suggest how this goal can be achieved with maven and 
>> distribution or
>> assembly plugin?
>>
>> -- 
>> View this message in context: 
>> http://maven.40175.n5.nabble.com/Multimodule-distribution-tp4574067p4574067.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> 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
>
>


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


Re: Multimodule distribution

Posted by Guillaume Polet <gu...@agilebirds.com>.
Hi,

I have set up this kind of project by using Multi-module project; 
packages are built with the assembly plugin. The thing is that I have 
two main branches in my multi-module project:
1) for all the jars of code: this branch configures all the general 
presets for all jars of the application.
2) for all the different packages I want to create: this branch 
configures all the general presets for all packages I want to have.

The Maven project structure looks like this:

Root
\---JARS
|   \---Core
|   \---Component A (Deps: Core)
|   \---Component B (Deps: Core)
|   \--- ...
\---PACKAGES
     \--- PACKAGE 1 (Deps: Component A, Component B)
     \--- PACKAGE 2 (Deps: Component B, Component ...)
     \--- ...

In the pom of PACKAGES, I have attached the maven assembly plugin to the 
build process (e.g. attached to the "package" phase).  In each packages, 
I declare the "correct" dependencies that needs to be embedded in each 
package. The key for you will be to create a proper assembly descriptor 
file.

Then if I use ´mvn clean install´ on the root pom and it builds all jars 
and then all packages. The bonus I get from such configuration is that I 
can use the "Package" pom's to create "Launch configurations" in 
development and I am then sure that it matches exactly what will be in 
each different package.

Guillaume
Le 11/07/2011 8:47, Ivan a écrit :
> Hello, guys!
> We have a project consisting of a main module (we call it core) and several
> configurable plugin modules (we call it component). By the application
> design each module is highly customizable and depends on one or more
> configuration files. When the application starts the "conf" folder is
> scanned and application configuration is constructed from all conf-files
> located in that folder. Depending on the usage scenario several combinations
> of configuration files may be used
>
> The basic aim we want to achieve is:
> 1) Have all possible configuration files stored in some folder of a module,
> e.g. for component A we have Aconf1.xml, Aconf2.xml and for component B
> Bconf1.xml and Bconf2.xml
> 2) For each target usage scenario we want to predefine a set of
> configuration files in a pom file that will build a distribution. E.g. for
> Scenario1 we should use Aconf1.xml and Bconf2.xml, but for Scenario2 we
> should use Aconf2.xml and Bconf1.xml
> 3) The resulting layout should look like ./lib - all *.jar files (core and
> components used) and ./conf - subset of configuration files specified in a
> distribution pom file.
>
> Can you suggest how this goal can be achieved with maven and distribution or
> assembly plugin?
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Multimodule-distribution-tp4574067p4574067.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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