Class TemplateProcessorMojo

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

    @Mojo(name="template-processor",
          defaultPhase=GENERATE_SOURCES,
          threadSafe=true,
          requiresProject=true)
    public class TemplateProcessorMojo
    extends org.apache.maven.plugin.AbstractMojo
    Maven mojo applying preprocessor templates.
    • Field Detail

      • intrinsics

        private final java.util.HashMap<java.lang.String,​IntrinsicMethod> intrinsics
      • project

        @Parameter(property="project",
                   readonly=true,
                   required=true)
        private org.apache.maven.project.MavenProject project
      • verbose

        @Parameter(defaultValue="false")
        public boolean verbose
      • incremental

        @Parameter(property="template.processor.incremental",
                   defaultValue="true")
        public boolean incremental
      • attachSources

        @Parameter(required=true)
        public java.lang.String attachSources
      • templatesDir

        @Parameter(required=true)
        public java.io.File templatesDir
      • outputDir

        @Parameter(required=true)
        public java.io.File outputDir
      • velocity

        private org.apache.velocity.runtime.RuntimeInstance velocity
      • templatesPath

        private java.nio.file.Path templatesPath
      • outputPath

        private java.nio.file.Path outputPath
      • timeVelocity

        private com.google.common.base.Stopwatch timeVelocity
      • timeIntrinsics

        private com.google.common.base.Stopwatch timeIntrinsics
      • timeTypeClassRefs

        private com.google.common.base.Stopwatch timeTypeClassRefs
      • timeComments

        private com.google.common.base.Stopwatch timeComments
    • Constructor Detail

      • TemplateProcessorMojo

        public TemplateProcessorMojo()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • execute0

        private void execute0()
                       throws java.io.IOException,
                              org.apache.maven.plugin.MojoExecutionException
        Throws:
        java.io.IOException
        org.apache.maven.plugin.MojoExecutionException
      • removeOtherFiles

        private java.util.List<java.nio.file.Path> removeOtherFiles​(java.nio.file.Path outputPath,
                                                                    java.util.List<OutputFile> keep)
                                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • verboseLog

        private void verboseLog​(java.lang.String message)
      • processTemplates

        private java.util.List<OutputFile> processTemplates​(java.util.List<TemplateFile> inputs)
                                                     throws java.io.IOException
        Apply templates to .ktype files (single-argument).
        Throws:
        java.io.IOException
      • generate

        private void generate​(TemplateFile input,
                              java.util.List<OutputFile> outputs,
                              TemplateOptions templateOptions)
                       throws java.io.IOException
        Apply templates.
        Throws:
        java.io.IOException
      • filterStaticTokens

        private java.lang.String filterStaticTokens​(java.lang.String template,
                                                    TemplateOptions templateOptions)
      • filterIntrinsics

        private java.lang.String filterIntrinsics​(java.lang.String input,
                                                  TemplateOptions templateOptions)
      • filterComments

        private java.lang.String filterComments​(java.lang.String input)
      • filterTypeClassRefs

        private java.lang.String filterTypeClassRefs​(java.lang.String input,
                                                     TemplateOptions options)
      • filterVelocity

        private java.lang.String filterVelocity​(TemplateFile f,
                                                java.lang.String template,
                                                TemplateOptions options)
        Apply velocity to the input.
      • targetFileName

        private java.lang.String targetFileName​(java.lang.String relativePath,
                                                TemplateOptions templateOptions)
      • scanFilesMatching

        private java.util.List<java.nio.file.Path> scanFilesMatching​(java.nio.file.Path dir,
                                                                     java.lang.String matchPattern)
                                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • collectTemplateFiles

        private java.util.List<TemplateFile> collectTemplateFiles​(java.nio.file.Path dir)
                                                           throws java.io.IOException
        Collect all template files from this and subdirectories.
        Throws:
        java.io.IOException