[Devtools] WixGen - Java API for WiX MSI installers using JAXB
Alex Kashchenko
akashche at redhat.com
Tue May 17 12:20:57 UTC 2016
Hi devtools developers,
I've been working on a MSI installer for OpenJDK (recently posted
details about OpenJDK on windows to internal devtools list). For that
installer I created a WixGen utility (github project link [1]) that
generates .wxs XML descriptors for WiX.
WiX is an open-source project from Outercurve Foundation [1], it is a
de-facto standard for MSI installers. It is written in C++ and C#, so it
doesn't have a direct Java API. Installer's "input descriptor" should be
written in XML format and then processed by WiX tools to generate a MSI.
Using WiX' XSD-schema [3] we can generate [4] JAXB classes [5] from that
schema that effectively gives us a Java API for generating XML
descriptors. JAXB-generated API is by no means elegant (example [6]),
but quite flexible - all WiX features can be used though it.
wixgen.jar utility (created on top of JAXB API) itself is not of much
interest - it is basically a limited (albeit fine-tuned) NIH version of
the WiX' heat utility [7]. But JAXB classes IMO may be useful for
developing additional tooling for creating MSI installers.
For example Maven plugin can be developed to build MSI installers for
Java applications. And more features can be packed into such plugin: for
example some time ago I was doing a Maven plugin [8] for installers
(non-MSI) to install Java apps as Windows Services using ProcRun/PrunSrv
[9] tools. The same Windows Services support can be done with WiX. And
as AFAIK main author of ProcRun/PrunSrv works for RH - such plugin can
be supported quite well.
Another example is a possible Eclipse plugin for WiX. VisualStudio has
one [10], probably something similar can be developed for Eclipse. And
while WiX is Windows-only, there exists a msitools project [11] in
Fedora that supports a subset of WiX' XSD-schema.
Currently there are no plans for the further development of WixGen, as
it currently covers required features for OpenJDK installer (link to MSI
[12] - as an example generated by WixGen). But if there will be some
interest in creating additional tooling for MSI installers - I can
assist in such efforts.
[1] http://www.outercurve.org/
[2] https://github.com/akashche/wixgen
[3]
https://github.com/akashche/wixgen/blob/c77cf791399b6b0a9304f4deec6b7aa14b80b280/wixgen-jaxb/src/main/resources/com/redhat/akashche/wixgen/jaxb/wix.xsd
[4]
https://github.com/akashche/wixgen/blob/c77cf791399b6b0a9304f4deec6b7aa14b80b280/wixgen-jaxb/pom.xml#L37
[5] http://akashche.github.io/wixgen/wixgen-jaxb/apidocs/
[6]
https://github.com/akashche/wixgen/blob/19bd1a0b7f24df5034a868f37eeff17c5a61d0df/wixgen-dir/src/main/java/com/redhat/akashche/wixgen/dir/DirectoryGenerator.java#L48
[7] http://wixtoolset.org/documentation/manual/v3/overview/heat.html
[8] https://github.com/alexkasko/windows-service-installer
[9] http://commons.apache.org/proper/commons-daemon/procrun.html
[10]
https://visualstudiogallery.msdn.microsoft.com/b6868002-9770-4479-80a7-259de34df527
[11] https://wiki.gnome.org/msitools
[12]
https://github.com/ojdkbuild/ojdkbuild/releases/download/1.8.0.91-3/java-1.8.0-openjdk-1.8.0.91-3.b14.windows.x86_64.msi
--
-Alex
More information about the Devtools
mailing list