Declare S9 example functions only if s9api on deploy-time class path
#520
+55
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Maven build has long offered an optional
-Psaxon-examplesprofile; without it, the examples jar gets built without theS9example, and can be deployed in a database without the Saxon jar loaded. With the profile active, the jar is built with theS9example included, and then that jar can't be loaded (withdeploy => true) unless the database already has a Saxon jar installed and on the class path, even if there is no need for theS9examples. That's an inconvenient restriction on later use of the examples jar based on a choice made at build time.Use conditional execution in the deployment descriptor so that even when the examples jar is built with the
S9examples included, they are only deployed if a Saxon API class is found on the class path at deploy time. That way, the examples can be built with thesaxon-examplesprofile active and still freely used without loading a Saxon jar if those examples are not of interest.Some inconvenient situations, though less likely ones, can still arise. If the examples jar is installed when no Saxon jar is on the class path (and so does not declare the
S9example functions), but laterremove_jaris called (withundeploy => true) when for some reason there is a Saxon jar on the class path, then the undeploy actions will detect the Saxon classes and try to drop theS9functions that had not been declared. But this is a rare "so don't do that" case that is easily avoided, nothing like the serious inconvenience of never being able to use the examples jar without installing Saxon first, depending on how the jar was built.