Examples of JAXBGenerator


Examples of com.envoisolutions.sxc.jaxb.JAXBGenerator

     */
    private Map<String,String> properties;

    public void execute() throws MojoExecutionException {
        try {
            JAXBGenerator jaxbGenerator = new JAXBGenerator();
            jaxbGenerator.setSourceOutputDirectory(sourceOutputDirectory.getAbsolutePath());
            jaxbGenerator.setClassesOutputDirectory(classesOutputDirectory.getAbsolutePath());
            jaxbGenerator.getClasses().addAll(Arrays.asList(classes));
            if (properties != null) {
                jaxbGenerator.getProperties().putAll(properties);
            }

            // need to manually create the classloader since maven won't give me one
            String directory = project.getBuild().getOutputDirectory();
            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
            if (classLoader == null) classLoader = getClass().getClassLoader();
            classLoader = new URLClassLoader(new URL[]{new File(directory).toURI().toURL()}, classLoader);
            jaxbGenerator.setClassLoader(classLoader);

            jaxbGenerator.generate();
        } catch (JAXBException e) {
            throw new MojoExecutionException("Error generating JaxB parser: " + e.getMessage(), e);
        } catch (MalformedURLException e) {
            throw new MojoExecutionException("Invalid build outputDirectory " + project.getBuild().getOutputDirectory());
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.