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
please don't do this, I will explain later
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.
no, please don't do this either. We need our resources in
src/main/resources/COB-INF to make them 'real blocks'. Doing something
different, would be a step into the wrong direction.
- 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.
WDYT?
The problem is that the solution doesn't handle dependencies and we don't get a
wiring.xml. Both problems are solved by the block-deployer.
Please have a look at my both tutorials
http://cocoon.zones.apache.org/daisy/documentation/g2/796.html
http://cocoon.zones.apache.org/daisy/documentation/g2/797.html
to get an idea how I think block deployment (and the creation of web
applications) should worl.
The first one already works and I will make the second one work ASAP (hopefully
this week) so that we can create a web application that consists of more than
one block.
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de