Class SchemaCompileMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="avro-compile",
          defaultPhase=GENERATE_SOURCES,
          requiresDependencyResolution=COMPILE_PLUS_RUNTIME)
    public final class SchemaCompileMojo
    extends org.apache.maven.plugin.AbstractMojo
    Mojo that will compile the avro sources: *.avsc, *.avpr, *.avdl in: 1) java files. 2) avsc files.
    Author:
    Zoltan Farkas
    • Field Detail

      • mavenProject

        @Parameter(defaultValue="${project}",
                   required=true,
                   readonly=true)
        protected org.apache.maven.project.MavenProject mavenProject
      • dependenciesDirectory

        @Parameter(name="dependenciesDirectory",
                   defaultValue="${project.build.directory}/schema-dependencies",
                   readonly=true)
        protected File dependenciesDirectory
        The directory where all schema dependencies (avsc, avpr, avdl) are made vailable
      • sourceDirectory

        @Parameter(name="sourceDirectory",
                   defaultValue="${basedir}/src/main/avro")
        protected File sourceDirectory
        The source directory of avro files. This directory is added to the classpath at schema compiling time. All files can therefore be referenced as classpath resources following the directory structure under the source directory.
      • generatedJavaTarget

        @Parameter(name="generatedJavaTarget",
                   defaultValue="${project.build.directory}/generated-sources/avro")
        protected File generatedJavaTarget
        the destination for the java generated files.
      • generatedAvscTarget

        @Parameter(name="generatedAvscTarget",
                   defaultValue="${project.build.directory}/generated-sources/avsc")
        protected File generatedAvscTarget
        the destination for the generated avro schema json files (will be published along with the java code).
      • target

        @Parameter(name="target",
                   defaultValue="${project.build.directory}")
        protected File target
        the target folder.
      • mavenSession

        @Parameter(defaultValue="${session}",
                   required=true,
                   readonly=true)
        protected org.apache.maven.execution.MavenSession mavenSession
        The current build mavenSession instance.
      • useSchemaReferencesForAvsc

        @Parameter(name="useSchemaReferencesForAvsc",
                   defaultValue="false")
        protected boolean useSchemaReferencesForAvsc
        This option will use schema references when writing schemas that depend of schemas from other projects, instead of baking them in. by default (false) all schema references will be inlined.
      • schemaArtifactClassifier

        @Parameter(name="schemaArtifactClassifier",
                   defaultValue="avsc")
        protected String schemaArtifactClassifier
        the schema artifact classifier.
      • schemaArtifactExtension

        @Parameter(name="schemaArtifactExtension",
                   defaultValue="jar")
        protected String schemaArtifactExtension
        the schema artifact extension.
      • repoSystem

        @Component
        protected org.eclipse.aether.RepositorySystem repoSystem
        The entry point to Aether, i.e. the component doing all the work.
    • Constructor Detail

      • SchemaCompileMojo

        public SchemaCompileMojo()
    • Method Detail

      • getPackageMvnIdPrefix

        public CharSequence getPackageMvnIdPrefix()
      • deleteGeneratedAvailableInDependencies

        public void deleteGeneratedAvailableInDependencies()
                                                    throws IOException
        Throws:
        IOException
      • deleteSchemasAvailableInDependencies

        public void deleteSchemasAvailableInDependencies​(Path schTargetPath)
                                                  throws IOException
        Throws:
        IOException
      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
                            org.apache.maven.plugin.MojoFailureException
        Children must call this.
        Specified by:
        execute in interface org.apache.maven.plugin.Mojo
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException
      • compileIdl

        public void compileIdl​(Path pSources)
                        throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • addMvnIdToIdlsAndMoveToDestination

        public void addMvnIdToIdlsAndMoveToDestination​(Path destPath)
                                                throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • compileAvpr

        public void compileAvpr​(Path pSources)
                         throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • getSourceFiles

        public String[] getSourceFiles​(String pattern)
      • getFiles

        public static String[] getFiles​(File directory,
                                        String pattern)
      • toString

        public String toString()
        will be overwritten as needed, and override will include this result.
      • getRepoSystem

        public final org.eclipse.aether.RepositorySystem getRepoSystem()
      • getMavenSession

        public final org.apache.maven.execution.MavenSession getMavenSession()
      • getMavenProject

        public final org.apache.maven.project.MavenProject getMavenProject()
      • getGeneratedAvscTarget

        public final File getGeneratedAvscTarget()
      • getTarget

        public final File getTarget()