cmarchand / maven-catalogBuilder-plugin

A plugin to build xml catalog corresponding to project depencencies
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Generate a catalog compatible with Oxygen reload mecanism #8

Closed cmarchand closed 5 years ago

cmarchand commented 5 years ago

Using URIs like

jar:file:/$HOME/.m2/repository/...

causes problem. If a jvm loads a jar with this URI, which is the default mecanism when a resource inside the jar is accessed, then, reloading the resource is impossible. This make Oxygen unable to update its dependencies speficied via a catalog that uses this kind of URL.

Here is Adrian Buza comment, from mail exchange on oxygen mailing list :

The problem is you're using the "jar:file" protocol with a .jar file. The Java loading mechanism of jar files is meant for static Java resources (especially meant for Java class files) which are only loaded once when they are needed. So, any changes you do to the jar in the file system after the jar has already been loaded by the JVM will not be available until the JVM (Oxygen) is restarted. This is normal Java behavior and cannot be avoided. Oxygen cannot change this behavior as long as the jar gets loaded within its own JVM. Saxon transformations from Oxygen are run within Oxygen's JVM. This works fine in the command line because the JVM loads and exits every time you run Saxon.

Oxygen provides an alternative means to do what you want via the "zip:file" protocol, but, obviously, this only works within Oxygen. Try using: <xsl:import href="zip:file:/Users/cmarchand/devel/foe.jar!/path/to/file.xsl" />

We should be able to produce two catalogs, the first, existing, unchanged, and a new one, using this kind of URL protocol : zip:file:/. This is only Oxygen compatible, but very useful !

cmarchand commented 5 years ago

Release 3.1.0 has been published.

Just add <generateOxygenCatalog>true</generateOxygenCatalog> in configuration, and that's it !

By default, this config property is false, hence default behavior is not changed.