views:

140

answers:

2

Hi Stackoverflow,

first of all: my Maven knowledge is limited so please bear with me. ;-) I have a simple Maven Project currently consisting of three modules. The module containing the core of the application is called core (Creative name, huh? :-)) and the other modules are basically plugins for this core module. There is one restriction: Only one plugin can be added to the core module.

The core module has its own Spring IoC configuration minus the plugin configuration. This is quite simple: The core code will read a bean named "plugin" which is not defined in the core configuration. The plugin modules will ship their own configuration files which will supply a bean named "plugin" which is then used by the core code. This fits perfectly in my use-case.

I want to provide the Admin, which will deploy the system, a simple way to build a distribution containing the core, a selected plugin and a reasonable default configuration. Maybe a tar.gz or something like that. I don't want him to dig though my Spring IoC files, copy them together, etc. etc. The actual configuration like TCP/IP ports are done in property files.

To clarify what i mean I've build an example structure. Note that the filenames are for explanation purposes only.

/bin/core.jar [Build from core module]  
/bin/plugin.jar [Build from a plugin module]

/lib-bin/library-required-by-plugin.jar [Dependency resolved by maven + copy]
/lib-bin/library-required-by-core.jar [Dependency resolved by maven + copy]
/lib-bin/another-library-required-by-core.jar [Dependency resolved by maven + copy]

/etc/spring/core-beans.xml [Copied from core module /etc/]
/etc/spring/plugin.xml [Copied from plugin module /etc/]
/etc/default-core-config.properties [Copied from core module /etc/]
/etc/default-plugin-config.properties [Copied from plugin module /etc/]

I currently mess around with the assembly plugin but i seem to go round in circles and nothing works. Pretty frustrating. If you need any more information or do not get my point feel free to ask. :-)

Addition to clarify my question: How to do that? (Well, its just that simple :-)) As I stated before, my knowledge of Maven is limited and currently i'm getting nowhere, even if I know that the assembly plugin might be the way to go. Especially how to get the dependencies from each module, where to configure the plugin (In the parent project?) and even a bit of an assembly descriptor would help a lot.

Thank you for all your input!

A: 

If you are just expecting a confirmation, then I confirm that the situation you have described is a perfect use case for the Maven Assembly plugin. I'd just use separate profiles to deal with the restriction ("Only one plugin can be added to the core module").

If you are expecting more specific guidance, please add a specific question :)

Pascal Thivent
Added another paragraph with actual questions. I know, this is very generic since I'm totally stuck, even I have nothing at the moment. Thanks so far!
Malax
+1  A: 
crowne
Looks promising, I will try this.
Malax
Thank you for your answer, it provides me at least with a rough starting point. Now I have to find a way to include the modules into the assembly... If anyone has snippets for that: you will be welcome!
Malax
crowne