General
Using Janno Maven
Other stuff
A plugin for the Apache Maven
build system that provides an easy way to build advanced web applications based on
the Janno modular webapp platform while retaining the flexibility and support offered
by standard war
deployment.
Jamecs provides a powerful, flexible, and highly sophisticated solution to the problem of building modern web-applications with dynamic functionality (such as is commonly supplied by modules or plugins), and it's standalone packaging as a self-contained web-server with browser-based administration and configuration makes it an ideal platform for non-developers wishing to leverage the power of the JEE platform and existing Java code.
Unfortunately, those same features create a world of pain for those experienced with Java and wishing to build standard web applications while taking advantage of the advanced dynamic deployment, scripting, and action support offered by Jamecs. Since Janno is really the core of Jamecs, with everything else provided by the standard modules, the obvious solution is to unpack the Janno war and set it up exactly as you need to - that is what this plugin does.
The Janno plugin is a Maven 1.x plugin. If Maven 2 ever becomes worth plugging into, we'll let you know...
The plugin is designed to work with the version of Janno you are working with - most of Maven's problems arise due to lazily-written plugins with (usually old) Jars hardcoded into them. Instead, the Janno plugin uses the version you specify as a regular Maven dependency.
Of course you have that option, and there's nothing wrong with doing that. There are a few extra benefits you get with the plugin, however:
The plugin is completely compatible with the War plugin, so start just as you would any other Webapp, except bear in mind that nothing is required anymore since the Janno war will be unpacked behind your application. You just provide the stuff you need to override from the default Janno layout in the appropriate places, and it will replace the default when building the war.
You'll need to list the 'janno-base' war as a dependency to your project. The following will use version 0.10:
<dependencies> <dependency> <groupId>jamecs</groupId> <artifactId>janno-base</artifactId> <version>0.10</version> <type>war</type> <dependency> <dependencies>
You will of course need to make sure your Maven repository has the War installed, or alternatively add the RPOT repository to your sources list. Try something like:
maven.repo.remote=http://www.ibiblio.org/maven,http://roscopeco.co.uk/maven
in your project.properties
file.
With this set up, and your custom stuff in the standard place (src/webapp
by default) you'll be able to simply type:
maven janno
And get your Janno-based War built in the target
directory.
See the Goals page for more details.
If you find you often need to get the standard Janno web.xml
and/or
the scoped context configurations, you might also find the janno:webxml
goal useful - it automatically extracts from your chosen Janno version (from
the Maven dependencies of the project).
The Janno plugin is really just a pretty thin layer over the top of the
standard war
plugin, so any configuration you could do before,
you can do now. See the War plugin's reference at
http://maven.apache.org/reference/plugins/war.
The plugin itself provides little configuration, limited to affecting
the filename patterns included/excluded from the Janno unpack, and
deciding whether to keep Janno's META-INF
(you don't want it).
This is handled by properties (set in project.properties
) as
detailed on the properties page.
It's pretty common to need to use the Janno utility classes in Java code
within your application, and with the War dependency you obviously can't
do that. The solution is to add the standard janno.jar
to your
dependencies as well as the janno-base.war
, but
don't define the war.bundle
property. That
way, Maven will map it into the build classpath without affecting the
Jar bundled with Janno Base.
The same situation applies to other Jars that are bundled with Janno -
If you need to use Moxy (another common one) or Sitemesh (to provide custom
decorators for example) then simply add a dependency to your project without
war.bundle
.
There is one caveat - you must make sure that your dependency versions
match up with the Janno versions or you are likely to see all kinds of
interesting errors from the JVM. If you need to upgrade a Janno dependency
the easiest thing to do is write a simple post-goal for war:webapp
to massage your libraries.
You can grab any version (or just the latest) of the plugin source from the Roscopeco CVS repository. See CVS Usage for more information.
Additionally, we have a web-based interface for CVS browsing, which allows you to quickly get to any version, get diffs, download versions, and even look at statistics if that's what floats your boat. See http://cvs.roscopeco.co.uk/viewrep/Janno-Maven.
As well as the Janno homepage at http://jamecs.sourceforge.net/docs/janno, you can find (and even help with!) the most up-to-the-minute documentation for all of Jamecs on our Wiki at http://wiki.roscopeco.co.uk/.