Maven, eXist-db and EXPath

Adam Retter

adam@evolvedbinary.com
@adamretter

eXist-db Community Meetup
XML Prague 08/02/2018

Part 1.
Mavenizing eXist-db

Building eXist-db

  • Complicated build system

    • Apache Ant

    • Bespoke project layout

  • Modularizing eXist-db has failed

    • Difficult to define module boundaries

    • Hard to isolate test failures (to a module)

    • XQuery Extension modules have no location for tests

  • No real dependency management

    • Some dependencies in VCS / downloaded by Apache Ivy

    • Clean and Build without Internet connection is impossible

    • Some duplicate/conflicting dependencies, e.g. YAJSW, etc.

    • No alerts on dependency security issues, e.g. OWASP, etc.

Building eXist-db

  • IDE project files have to be maintained manually

  • Difficult to use eXist-db as an embedded database in a Java project

  • Generating a release is complicated

    • Several Manual Steps

    • Fixed Release Products (no pick-and-mix)

Benefits of switching to Maven

  • A modular eXist-db

    • Standard Project Layout

    • Each module has its own source code, tests, and resources

    • Modules can be built and tested (somewhat) independently

    • Different release products containing more or less modules

  • Dependency management

    • Downloaded on demand (and cached)

    • Conflicts can be detected and (automatically) resolved

    • Auto-checked for newer versions and/or Security alerts

  • Most IDEs natively support Maven Projects

  • Building and publishing can be a single command

Progress Report: Adopt Maven

  • Tool for Mavenizing eXist-db

    • https://github.com/adamretter/mavenize-exist

    • A set of Bash scripts and POM files

    • Input: a clone of the eXist repo

    • Output a Maven project

      • exist-parent module

      • exist-core module

  • Can run the eXist test suite using Surefire

  • Needs a further investment of time...

  • DEMO!

Part 2.
EXPath Packages and Maven

Creating EXPath Packages

  • Maven EXPath Pkg plugin

    • https://github.com/claudius108/kuberam-expath-plugin

  • Simplify: We provide a Maven archetype for users

    • https://github.com/eXist-db/exist-apps-archetype

    • Just generates a skeleton project:

      • Example XQuery Library Module written in Java

      • Example XQuery Library module written in XQuery

      • Build system for your project

      • Will create the EXPath Pkg Metadata for you

      • Ultimately builds an EXPath Pkg XAR file for you

  • Very easy for you to use!

  • DEMO!

Part 3.
Refelections on EXPath Pkg Spec

EXPath Pkg Spec :-/

  • Bad

    • Dependency management

    • Metadata descriptors

    • Auto Module registration

    • Interoperability

    • Extensibility

    • Publication/Distribution

  • Good

    • Documented conventions

    • Standard package file format

EXPath Pkg Spec :-/

  • Many wheels reinvented!

    • Make more use of Maven ecosystem

      • Maven is much more than `mvn` command

      • Maven ecosystem also used by Ivy, Gradle, SBT, Buildr, etc.

    • pom.xml files

      • Manage and reflect dependencies

      • Contain metadata needed for EXPath Package files

      • Maven Extension for .xar files (just like .nar files)

    • Distribute via Maven Central or other Maven ecosystem compatible repo.

  • We can do so much better through reuse!

Maven, eXist-db and EXPath

By Adam Retter

Maven, eXist-db and EXPath

Talk given at eXist-db Meetup 8 February 2018 - XML Prague 2018

  • 3,048