Example 18: Commons
-
What will we do? - Create a commons share code asset
-
What do you need? - Site access to a non-production Windchill
-
How long will it take - 10 minutes
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
This is because the bootstrap calls the commons
and the pom includes it
We can either build it or take if from a repository like Nexus
To test a new commons update the version and alter the code
You can build this and include it explicitly in the pom
And now this code will use this version