ElementParserGeneratorMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException { try { SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); IDCollector idCollector = new IDCollector(); SaxIDCollector schemaHandler = new SaxIDCollector(idCollector); saxParser.parse(schema, schemaHandler); idCollector.finish(); ElementParserGenerator generator = new ElementParserGenerator( outputDirectory, name, pkg, idCollector, project, projectRequired, getLog()); generator.run(); } catch (RuntimeException ex) { throw ex; } catch (ParserConfigurationException ex) { throw new MojoExecutionException("Parser Configuration Exception"); } catch (IOException ex) { throw new MojoExecutionException("IO Exception", ex); } catch (SAXException ex) { throw new MojoExecutionException("Invalid Schema", ex); } catch (TemplateException ex) { throw new MojoExecutionException("Template error", ex); } } ElementParserGeneratorMojo();   ElementParserGeneratorMojo(File outputDirectory, File schema, String pkg, String name); @Override void execute(); static String Version; }
@Test public void testExecute() throws Exception { ElementParserGeneratorMojo instance = new ElementParserGeneratorMojo( new File("target/generated-sources/test"), new File("src/test/resources/schema/menu.xsd"), "test.menu", "MenuTest" ); instance.execute(); }