logo

MMBase tips

Install a component

tip #10 / Mon 8 Mar 2010 / André / 0 comments

Since 1.9 mmbase features a framework with an easier way to install different applications or functionalities, they're called components. Most of the older applications have been converted to these easy-to-install components and all new ones are created as components, like for example Streams.

Components generally consist of two parts: templates and code. By default the templates need to end up in '/mmbase/components/[component-name]', the code packaged in a JAR or WAR in '/WEB-INF/lib'. There are two main methods to installing both: use Maven to build a webapplication or just the files manually.

Maven

Easiest - and the preferred method when you're building a new web application - is to use Maven 2 while you are building your webapp. Include the following with 'dependencies' in Maven's 'pom.xml'.

<dependency>
  <groupId>org.mmbase</groupId>
  <artifactId>mmbase-mynews</artifactId>
  <version>1.9.2</version>
  <type>war</type>
</dependency>

When you run 'mvn clean install' the MyNews application war is downloaded and everything is installed using overlays in the right places in your webapp.

Just the files

Another method is to just download the component, unpack it and install the files in their locations in your web application. MyNews can be downloaded at http://www.mmbase.org/maven2/org/mmbase/mmbase-mynews/1.9.2/mmbase-mynews-1.9.2.war Unpacking it yields the following directories:

META-INF
mmbase/components/mynews
mmbase/mynews
WEB-INF/classes
WEB-INF/lib

All templates can be found in the 'mmbase' directory, the code in 'WEB-INF/lib'.
The others 'META-INF' and 'WEB-INF/classes' are not necessary, they were generated by Maven and are mostly empty.

The code and all configuration is in 'WEB-INF/lib/mmbase-mynews-1.9.2.jar'. If you ever need to alter a configuration setting you will need to unpack this jar. The changed configuration file goes in its mirrored position in the 'WEB-INF/config'.
The 'mmbase-mynews-1.9.2.jar' - of course - goes in your webapp's 'WEB-INF/lib'.

The directory 'mmbase/components/mynews' contains the templates that are part of the generic component structure. These 'mynews'  jspx files need to be in that exact same directory in your webapp. 
The other templates directory can be installed anywhere if you want.

0 comments

RSS feed

Tweet this article

Most mentioned links:

MMBase documentation
MMBase API
MMBase SVN
Bugtracker
MMBase Taglib reference
The reference for all tags mm