tags:

views:

85

answers:

1

Something similar has been asked in maven user list but I have the situation, similar to that.

I have some service, packaged as .WAR, which is build by maven. However, this .WAR file requires customization: I need to package it in different ways, depending on user input. Basically, user should himself select the components, he would like to add to WAR, and define some simple configuration for these components.

What I need to do is:

  1. Create a "lightweight" installator, that will not contain any maven artifacts (or, if that's not possible, contain all of them = "heavyweight" installator).
  2. When end user launches the installator, he is asked for the list of components to package (=checkboxes)
  3. For each component, installator asks for the configuration options (then to be saved as .property files, one per component)
  4. Installator then fetches only the artifacts needed (selected by user + those which are obligatory), and replaces the property file(s) in those artifacts by those from step 3 (or puts them to "classes/").
  5. Finally it creates ready to-use WAR package and (optionally) launches tomcat (or jetty) in a background.

IzPack helps to solve step 2 only. But is there any universal solution for that?

+1  A: 

I don't know any universal solution doing that, especially something that will package a customized WAR. IzPack can gather install parameters (and maybe help to solve step 3), IzPack has an advanced feature called Web Installers that could help to solve step 4, but to my knowledge, it's not a build/packaging tool, so it won't cover step 5 (the most important).

Maybe a maven archetype could help here (in interactive mode). But I'm not even sure an archetype will offer the level of flexibility you need. In other words, it won't be simple.

Actually, in your case, I think that Ant (with Maven Ant Tasks or Ivy) would be the best option. I know this is not what you asked for but I don't think Maven is the right tool for your use case.

Pascal Thivent
Thank you for the information about WebInstallers - that is what I didn't know. I suggest:1. Installator is fetched by user and run. Then it:2. Checks, if maven is installed. If not, it unpacks maven to temp directory.3. Executes mvn scm:checkout -DconnectionUrl=scm:svn:https://gforge.mysite.com/svn/trunk/service -DcheckoutDirectory=service4. Asks for needed modules and generates (updates) POM file in just checked-out 'service' directory5. Asks for additional options and generates .property files6. Executes mvn packageDoes it make sense to use IzPack in this case?
dma_k
@dma_k Well, it's not a simple use case so this would require testing but... maybe.
Pascal Thivent