views:

144

answers:

1

I have a maven project which consists of a few modules. This is to be deployed on a client machine and will involve installing Tomcat and will make use of NSIS for installer. There is a separate application which monitors tomcat and can restart it, perform updates, etc.

So, I have the modules setup as follows:

project
  +-- client (all code, handlers, for the war)
  +-- client-common - (shared code, shared between monitor and client)
  +-- client-web - (the war, basically just uses war has applicationcontext, web.xml,etc)
  +-- monitor - (the monitor application jar. Uses wrapper to run)

So, I need to create an installer. I was planning on creating another module which would be the installer. This is where I would have tomcat directory and I'd like maven to "assemble" everything and then run NSIS so I can create the final installer.

However, I need to have the monitor jar file in a directory and then have all monitors dependencies in a lib/ directory. The final directory structure should be:

project-installer-directory/monitor/monitor-version.jar
project-installer-directory/monitor/lib/monitor-dep-1.jar
project-installer-directory/monitor/lib/monitor-dep-2.jar
project-installer-directory/monitor/lib/monitor-dep-3.jar
project-installer-directory/webapps/client-web.war

Where in the client-web\WEB-INF\lib directory we will have all client-web's dependencies after it is exploded. That works, I have the .war file. What I am having problems with is getting the monitor module dependencies independent of the dependencies of the client-web module.

I tried to just create the installer module and make the monitor and client-web dependencies, but when I use dependencies-copy it gives me everything. Not what I want.

I'm leaning towards creating a new module called monitor-assembly or something to give me a zip file which contains the directory format I need, but that is yet another module.

Can someone please help me with the correct way to accomplish this?

thanks!

A: 

The most elegant would be to write an own Maven plugin or to extend maven-dependency-plugin. Actually what you need is quite close to dependency:copy-dependencies, but you need a possibility to specify which artifact you want to start with. As I see from the code, this is not possible at the moment.

Further idea: You can create one zip assembly per module (including module dependencies you need) and use dependency:unpack to unpack these zips in your installer module.

lexicore