public SchemaTypeSystem compileSchemaTypeSystem(Definition definition) throws DeploymentException {
List schemaList = new ArrayList();
addImportsFromDefinition(definition, schemaList);
// System.out.println("Schemas: " + schemaList);
Collection errors = new ArrayList();
XmlOptions xmlOptions = new XmlOptions();
xmlOptions.setErrorListener(errors);
xmlOptions.setEntityResolver(new JarEntityResolver());
XmlObject[] schemas = (XmlObject[]) schemaList.toArray(new XmlObject[schemaList.size()]);
try {
SchemaTypeSystem schemaTypeSystem = XmlBeans.compileXsd(schemas, basicTypeSystem, xmlOptions);
if (errors.size() > 0) {
boolean wasError = false;