Maven and jelly
1 / 32

Maven and Jelly - PowerPoint PPT Presentation

  • Uploaded on

Maven and Jelly. James Strachan. Introduction. Maven and Jelly are both Apache projects at Jakarta Ultimately both will be top level projects inside Jakarta Right now Maven is inside Turbine and Jelly is inside Commons. Topics of Discussion. What is Maven

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Maven and Jelly' - wynona

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Maven and jelly

Maven and Jelly

James Strachan


  • Maven and Jelly are both Apache projects at Jakarta


  • Ultimately both will be top level projects inside Jakarta

  • Right now Maven is inside Turbine and Jelly is inside Commons

Topics of discussion
Topics of Discussion

  • What is Maven

  • What is Jelly

  • Should we use these things?

  • How, what, why, when…



  • It’s a Java project management and comprehension tool

  • Think a layer above Ant

  • Avoid us all hacking Ant build files

Build history
Build history

  • First there was make. But was not cross platform.

  • Ant came along as a Java-centric build system that was cross platform

  • We now spend lots of time hacking Ant’s build.xml files

Itches maven scratches
Itches Maven Scratches

  • We should be able to share build.xml files

  • Often not much changes from project to project, other that the dependencies (classpath).

  • Maintaining real version information and setting the classpaths are a PITA

Early maven
Early Maven…

  • In the early days, Maven used Ant

  • We shared Ant build scripts.

  • Customization was through Ant callbacks.

  • Worked OK, was slow but callbacks suck

Maven b5 onwards
Maven b5 onwards…

  • Along comes Jelly…

  • A more flexible front end to Ant.

  • Uses a goal library for Jelly which allow pre/post actions to be registered or goals to be replaced.

  • Goal library is a neat replacement for hacky Ant callbacks.

So how does maven work
So how does Maven work?

  • You create a project.xml which describes your project

    • Project info (name, company, website etc)

    • Where the source code is

    • Where the unit test cases are

    • What the dependencies are

Maven and jelly

  • From the command line type

    maven -g

  • To see all the possible goals

    maven site:deploy

  • Will build all your code and website

    • run your unit test cases, create a report, javadoc, source code cross reference, CVS log, file activity…

Example project xml
Example project.xml










What actually happens
What actually happens…

  • project.xml is used to create a POM (Project Object Model)

  • Its reusing Ant tasks under the covers

  • We are sharing (something like) build.xml documents across projects

  • A Jar repository is used to automatically download required jars and to set the classpath

  • All dependency information is automatically documented. It can be embedded into jar manifests too.

Maven repository
Maven Repository

  • A local repository and a list of remote repositories.

  • Supports mirroring and N-tier of repositories

  • New jars can be download

  • Repository can be shared across projects

  • Can be used for multi-version testing

What actually happens1
What actually happens…

  • Its just reusing Ant tasks under the covers

  • We are sharing (something like) build.xml documents across projects

  • A Jar repository is used to automatically set the classpath

  • All dependency information is documented. It can be embedded into jar manifests too.


  • Maven is built around a plugin architecture

  • There’s already a lot of plugins. Type ‘maven –g’ and you’ll see.

  • The plugins are gonna grow and grow.

  • Plugins use the same repository, so no need to worry about setting classpaths…

  • As soon as a new plugin is written, we all get to use it, without hacking build.xml

Some plugins
Some plugins…

  • site:deploy – builds and deploys your entire developer website

  • dist:deploy – builds and deploys your distributions

  • test – runs your unit tests

  • test:single-test –Dtestcase=Foo

  • test:ui – runs the Swing JUnit TestRunner

  • Many others…

    • Eclipse plugin, Clover, WAR, EAR, JDiff, CVS log, project metrics, JDepend etc.

So main benefits of maven
So main benefits of Maven

  • No more classpath blues when building

  • We are sharing (something like) build.xml documents across all projects

  • Real dependencies are documented and managed

  • We all get to share plugins added to Maven

Maven reactor
Maven Reactor

  • Building lots of projects with interdependencies

  • Like Gump (

  • Can be used for Continuous Integration, running combinations of versions of multiple projects.

  • Using workflow of builds, distributed across servers

  • Builds, runs test cases and creates reports

Continuous integration
Continuous Integration

  • Early warning system when things break due to

    • Code changes

    • Different platforms (OS, JDK)

    • Different dependencies (e.g. change to XML parser or other dependent library)

  • We could reuse this infrastructure for doing integration testing across versions, platforms and different dependency sets.

Customizing maven
Customizing Maven

  • Create, or local, or ~/

  • Write a plugin

  • Create maven.xml

Maven xml

  • plugin.xml, project.xml and maven.xml are all Jelly scripts.

  • Can use POM beans like ${}

    <j:forEach var=“d” items=“${pom.dependencies}”/>

    <copy file=“${d.jar}” todir=“${foo}”/>


Its jelly time
Its Jelly time…

  • Java & XML based processing engine.

  • Superset of Ant build.xml language and JSTL

  • Allows mix and match of declarative and procedural XML languages.

  • Can include other XML languages like BPML, BPEL4WS, WSCI, WSDL invocations etc.

  • Turns any XML document into a ‘script’ that can be ran

Pluggable languages
Pluggable languages

  • Pluggable expression languages like JSP EL, Velocity, XPath etc.

  • Pluggable scripting languages, beanshell, JavaScript, Jython.

  • You can plug in your own XML languages or custom beans


  • Simple and lightweight

    • Can be ran from command line, used in Maven, in applet, application server etc.

  • Open and extensible

  • XML Namespace URIs can be bound onto a Jelly Library

    • An XML tag name can be bound onto Java code via a Tag

  • Expressions can be used within the XML

Based on xml
Based on XML

  • Jelly scripts are parsed from SAX.

    • Can use HTML parser to use non-well formed Jelly scripts.

  • Jelly is based on an XML pipeline architecture.

  • A Tag can consume, emit, filter or transform the XML events of its body.

  • Very powerful, flexible scripting and XML processing engine

  • Ideal for processing XML, SOAP, Web Services etc.

Bean example
Bean example…


<j:if test=“${ = ‘abc’}>


<j:forEach var=“order” items=“${bean.orders(‘uk’, foo)}”>

<productOrder id=“${}”>




Xml example
XML example…

<x:forEach select=“$doc//food[@kind=‘cheese’]”>

<x:if test=“bar = ‘abc’”>

do something…



<x:expr select=“pizza[@topping]”/>



Sql example
SQL example…

<sql:query var=“results”>

select * from customer


<j:forEach var=“cust” items=“${results.rowsByIndex}>

<customer id=“${}”>





  • Can write tag macros in Jelly script or bind tags to beans

  • Very flexible. E.g. can be used to implement

    • JSTL, page templating system etc.

    • Maven build system

    • workflow languages

    • declarative integration scripts (WIS etc)


  • Uses Jelly script to implement unit testing

  • Can mix and match beans, SQL, JMS, XML validation, XPath evaluation, SOAP calls, HTTP etc.

Jellyunit example
JellyUnit example

<test:case name=“someTest“>

<test:assert test=“${ == ‘abc’”/>

<x:parse var=“doc“xml=“foo.xml”/>

<test:assert xpath=“$doc/foo/bar”>

Found the bar!




  • Maven is a great tool for managing and building projects

  • Increasingly Maven’s project based Continuous Integration and build/test workflow abilities will be invaluable

  • Jelly can be very useful in both unit and integration testing