Carsten Ziegeler wrote:
After some thinking I think I have a simple solution to our problem
about how to build trunk with m2: it's simple, Maven can do this for us!

The Maven war plugin is able to assemble the webapp by combining the
contents of several war projects. So if we change all of our blocks
projects (that have samples or web resources) from "jar" to "war" and
then add the dependency to the war project in the pom in cocoon-webapp,
Maven does everything for us. I just tried this with the
cocoon-session-fw-sample block and it seems to work. Though I did not
get everything working. See below

Now - as always - there are some (minor) problems:
- Currently Maven requires that a war has a web.xml: This requires to
add a dummy web.xml to each sample block; this web.xml is later on
ignored as the web.xml from the cocoon-webapp is used. I guess if we go
this way, we can ask the maven guys to provide some option to make
web.xml optional.
- We have to restructure the directory layout of our blocks a little
bit: all resources for the webapp should go to src/main/webapp. So, for
example a block with a configuration (no sample block) has:
src/main/webapp/WEB-INF/conf with the configuration files while a sample
block might have a src/main/webapp/samples/blocks/BLOCKNAME/ directory.
- This seems to require the development version of the webapp plugin and
I wasn't able to include two webapps (session-fw-impl and session-fw).
Though looking at the code, it should work, m2 refused to do this, but
I had a week network connection, so it might be due to this?; I don't
have time today to invest here further, but I'm sure it should work,
so this should be a viable solution.

I think someone recently raised the question, how we distinguish between
sample and and functionality blocks. I think for now we can go with a
naming convention: if you want the sample, you depend on the sample
project, if not you depend on the impl.
I like it. Still I have one big issue with m2 webapp approach:

mvn war:inplace copies all resources to cocoon-webapp/src/webapp directory. There is no mvn clean for that and no easy way to tell which file really belongs to cocoon-webapp/src/webapp/** and which one is copied over from another module (and under no circumstances should be commited to the repository).

--
Leszek Gawron                                      [EMAIL PROTECTED]
IT Manager                                         MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

Reply via email to