The following steps illustrate basic use of the Castor Plug-in for
Create a new Java project for your Castor-generated files.
You can use an existing project, if you already have one. Make sure
the project has at least one Java Source folder (i.e., it does not
use the project root as both source and output folder for your Java
Create a new Java Source folder in your project; e.g., gen.
This is the folder into which Castor Source Generator will place the
generated Java files. This separation is not necessary, but makes it
easier to distinguish generated files from those created manually.
Right-click the project and from the context menu select Castor
-> Add Castor to build path... This will allow you to select Castor
libraries to add to your project's Java build path. Alternatively, you
can choose to import the libraries into your project, if you need to
package and redistribute them with your code.
In your Project Navigator view, select the XML Schema (*.xsd)
file from which you want Castor to generate Java sources. Note that
the XML Schema file need not be in the generator's output project;
it may come from an entirely different project. From the main menu,
select Run -> External Tools -> Run As -> Castor Source
Generator. This will bring up a launch dialog populated with
Edit the values in the Generator tab to suit your
needs. When ready, click Run to launch the Castor Source
Generator. Any output messages will be printed into your Console
view. When finished, the output folder will contain the generated
To edit your newly created launch configuration, select Run ->
External Tools -> External Tools... in the main menu. To
display a shortcut to this launch configuration in favorites menu,
check the box in the Common tab. You may share this launch
configuration with others (e.g., through a version control system) by
marking it as Shared in the same tab; this will create a
*.launch file (whose file name matches the launch
configuration name) in the folder you specify.