This is a simple CLI tool to export several .xsd generated ISOXML packages into one .jar file for importing into your other projects.
Pre-setup
- For both LINUX and WINDOWS users (Windows Linux Subsystem not supportted), run command line
xjc -versionto check if you have xjc installed.
On successful installation, you will see
xjc 2.3.0-b170531.0717
On unsuccessful installation, you can make sure you have Java installed in your environment, this can be checked using command line java -version. xjc.exe comes as part of your jdk. (For WINDOWS user, remember to add path in system environment)
- run command line
mvn -versionto check if you have Apache Maven installed.
On successful installation, you will see
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00)
Maven home: D:\apache-maven-3.6.1\bin\..
Java version: 9.0.4, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-9.0.4
Default locale: en_SG, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
and can skip this section.
On unsuccessful installation, you can follow here to install Maven on WINDOWS or LINUX.
Create JAR from .xsd files
- Clone this repository using
git clone https://github.com/dlworldpeace/ISO-Packager.gitat yout preferred storage location.
Note: You can skip step 2 and 3 if you are not adding new .xsd files
- Add your new .xsd files into the
src/directory along all other existing .xsd files andmain/. - If your newly added .xsd files have other imports, ensure these imports exist in the same directory and their
"schemaLocation"of the import fields are updated accordingly, for example incitiBalanceInquiry.xsd
change from
<xsd:import namespace="urn:iso:std:iso:20022:tech:xsd:camt.052.001.02"
schemaLocation="citiconnect/iso/camt05200102.xsd"/>
to the following
<xsd:import namespace="urn:iso:std:iso:20022:tech:xsd:camt.052.001.02"
schemaLocation="camt05200102.xsd"/>
because the the required import file camt05200102.xsd is in the same directory.
Note: You can skip step 4 if you use WINDOWS system
-
From the
srclevel directory, runchmod +x parse_xsd.shto give the shell script executable permission. -
From the same directory as step 4, run command
parse_xsd.sh(for WINDOWS) or./parse_xsd.sh(for LINUX). This generates all the .java from .xsd atsrc/main/java/deskera/fintech/and thereafter exports all of them as a .jar package. -
Retrieve the generated .jar from
target/deskera-fintech-1.0.jar.
To update JAR name or version
If you want to change the name and version of the .jar exported, you can change them at <artifactId>deskera-fintech</artifactId> and <version>1.0</version> of pom.xml respectively before step 4 and 5 of Create JAR from .xsd files.
To learn more
What parse_xsd.sh does is a consecutive 2 steps of parsing and packaging:
-
An xjc command is used to parse each existing .xsd files into a folder of java classes, e.g.
xjc -d src/main/java -p deskera.fintech.citiBalanceInquiry src/citiBalanceInquiry.xsd -XautoNameResolution. -
a maven command
mvn pacakageis used to export the entire java package as a .jar file based on the settings inpom.xml.