Search in sources :

Example 1 with Jsonschema2PojoMojo

use of org.jsonschema2pojo.maven.Jsonschema2PojoMojo in project jsonschema2pojo by joelittlejohn.

the class CodeGenerationHelper method generate.

public static void generate(final URL schema, final String targetPackage, final Map<String, Object> configValues, final File outputDirectory) {
    try {
        @SuppressWarnings("serial") Jsonschema2PojoMojo pluginMojo = new TestableJsonschema2PojoMojo().configure(new HashMap<String, Object>() {

            {
                put("sourceDirectory", URLUtil.getFileFromURL(schema).getPath());
                put("outputDirectory", outputDirectory);
                put("project", getMockProject());
                put("targetPackage", targetPackage);
                putAll(configValues);
            }
        });
        pluginMojo.execute();
    } catch (MojoExecutionException | DependencyResolutionRequiredException e) {
        throw new RuntimeException(e);
    }
}
Also used : DependencyResolutionRequiredException(org.apache.maven.artifact.DependencyResolutionRequiredException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) JavaFileObject(javax.tools.JavaFileObject) Jsonschema2PojoMojo(org.jsonschema2pojo.maven.Jsonschema2PojoMojo)

Aggregations

JavaFileObject (javax.tools.JavaFileObject)1 DependencyResolutionRequiredException (org.apache.maven.artifact.DependencyResolutionRequiredException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 Jsonschema2PojoMojo (org.jsonschema2pojo.maven.Jsonschema2PojoMojo)1