SMILA/Development Guidelines/Setup for JAXB code generation

From Eclipsepedia

Jump to: navigation, search

Introduction

This page describes additional setup steps you need to do if you want to use JAXB to generate classes from XML schema descriptions for SMILA.

Steps to install needed libraries

  1. Setup a build library as described in SMILA/Development Guidelines/Howto build a SMILA-Distribution. In this document we will use lib/ as the root of it.
  2. The required JAXB compiler libraries are contained in our package of the SMILA build libraries. If you want to collect them on your own, use these instructions:
    1. Download the JAXB reference implementation 2.1.6 or above from http://jaxb.java.net/
    2. unpack it with (see here)
      java -jar <JAXB-version>.jar
    3. copy the following into your lib/xjc
      • all jars in the jaxb-ri-<version>/lib/
      • InterfacesXJCPlugin.jar, you can download it here

Your build lib directory should now look at least like this:

lib/
   ant-contrib/
      ant-contrib-1.0b3.jar
   xjc/
      jaxb-api.jar
      jaxb-impl.jar
      jaxb-xjc.jar
      InterfacesXJCPlugin.jar

Generate Sources from Command line

  1. Put SMILA.builder into the same folder as the bundle for which you are generating the folder (for all SMILA bundles this is the case after a checkout).
  2. To generate the classes, you can now use:
    ant -Dlib.dir=<SMILA-Build-Lib-Dir>

The JAXB classes should now be generated in the code/gen directory of your bundle.