Example 18: Commons

Overview

This example shows how to code a new commons library. This is important as it lets us share code between extentions

Description

A commons is important as if we code a useful function and we want to use it in another extension this avoids us copy and pasting the code (a very bad idea). We can also have different versions for the code and this allows use to limit any impact of change. An important part using a commons is the use of a parent pom that help significantly when using a set of commons libraries.

Implementation

The commons is here and the example wex that includes it here.

We can build an install the extension and when it is install the version of the commons appears in the log

image-20240208171450867

This is because the bootstrap calls the commons

image-20240208171750745

and the pom includes it

image-20240208171609520

We can either build it or take if from a repository like Nexus

image-20240208171713527

To test a new commons update the version and alter the code

image-20240208171845288

image-20240208171922718

You can build this and include it explicitly in the pom

image-20240208172032080

And now this code will use this version

image-20240208172118030