Class SnakeYAMLMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
io.helidon.build.maven.snakeyaml.codegen.SnakeYAMLMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="generate", requiresProject=true, defaultPhase=GENERATE_SOURCES, requiresDependencyResolution=RUNTIME) public class SnakeYAMLMojo extends org.apache.maven.plugin.AbstractMojo
Goal which generates code to help with parsing YAML and JSON using SnakeYAML.

SnakeYAML does a lot of work converting between JSON or YAML and bean classes, but it needs some help with information it cannot get from compiled class bytecode. This plug-in generates that helper code.

It analyzes Java sources in a specified location and generates a SnakeYAML TypeDefinition for each class. It also uses a second location to locate implementations of interfaces from the first area for use in setting the impl classes in those TypeDefinition instances.

Often, builds will use the maven dependency plug-in to extract sources into those two locations and then invoke the plug-in to analyze the code and generate the helper class.

  • Constructor Details

    • SnakeYAMLMojo

      public SnakeYAMLMojo()
  • Method Details

    • setInterfacesConfig

      public void setInterfacesConfig(SnakeYAMLMojo.CompilerConfig config)
      Sets the compiler config for analyzing the interfaces.
      Parameters:
      config - CompilerConfig for analyzing interfaces
    • setImplementationsConfig

      public void setImplementationsConfig(SnakeYAMLMojo.CompilerConfig config)
      Sets the compiler config for analyzing the implementations.
      Parameters:
      config - CompilerConfig for analyzing implementations
    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException
      Runs the goal, analyzing interfaces and implementations and generating the helper class.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - in case of errors while executing the goal