Gould, Troy (ELS) wrote:

Is there an easy way to add a block to an existing build?

I built Cocoon 2.1.2 a while back and have made a lot of
changes/additions/deletions to my cocoon.xconf and sitemap.xmap files, but
now want to add in the jsp block that I didn't include in the original
build.

Certainly.


1) In the most current cvs (even after 2.1.3) support was added to allow individual block targets to be called instead of the whole build. You may be able to back port those changes to your build script and try that (on a _copy_ of your webapp first). So probably from now on you could just point the build at your webapp dir and run that block's target to install just it.

2) The blocks build consists essentially of these steps:
- compile the sources
- jar the block specific source into a cocoon-blockname.jar
- move that jar and any from the blocks libs into webapp/WEB-INF/lib
- copy any necessary webapp resources into the webapp directory under (I think) a directory named after the block
- run the XPatch task (read up on wiki) to modify a number of different xml configuration files as needed. The patch files should be under src/blockname/conf. A possibly incomplete list of targets is sitemap.xmap, cocoon.xconf, web.xml, cocoon.roles, logkit.xconf (samples.xml - but you shouldn't need that). You can examine those files and apply the changes by hand or run xpatch in a build of your own using the same patch files.


Now, if you have made significant changes to those files (as I guess you have) you'll need to check that the XPatch files don't make bad assumptions about the state of those files. You're probably OK, but better make sure.

The good news is that it's much easier to add a block after build time than to remove one, and probably much easier to do now in 2.1 than it was in 2.0.x.

Now, a historical note: it is the complexity of these issues that drove
a) the redesign of the build process in 2.1 (and its current complexity) with the current build-time blocks as a baby step to "real blocks".
b) the (temporary!) source-only distribution in 2.1 which forces everyone to _add_ what they want by configuration options.
c) the vision of "real blocks" for 2.2 which will be "sealed" units which can be installed/uninstalled with great ease.


Hope that helps,

Geoff


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to