Class JandexGoal

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

    @Mojo(name="jandex",
          defaultPhase=PROCESS_CLASSES,
          threadSafe=true,
          requiresDependencyCollection=COMPILE_PLUS_RUNTIME,
          requiresDependencyResolution=COMPILE_PLUS_RUNTIME)
    public class JandexGoal
    extends org.apache.maven.plugin.AbstractMojo
    Generate a Jandex index for classes compiled as part of the current project.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.File classesDir
      By default, process the classes compiled for the project.
      private java.util.List<FileSet> fileSets
      Process the classes found in these file sets, after considering the specified includes and excludes, if any.
      private java.io.File indexDir
      The directory in which the index file will be created.
      private java.lang.String indexName
      The name of the index file.
      private java.lang.Integer indexVersion
      Persistent index format version to write.
      private org.apache.maven.project.MavenProject mavenProject  
      private boolean processDefaultFileSet
      If true, and if a file set rooted in the target/classes directory is not defined explicitly, an implied file set rooted in the target/classes directory will be used.
      private boolean skip
      Skip execution if set.
      private boolean skipForPomPackaging
      Skip execution if set and if the module's packaging is POM.
      private boolean verbose
      Print verbose output (debug output without needing to enable -X for the whole build).
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      JandexGoal()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute()  
      private java.lang.String[] findFilesToIndex​(FileSet fileSet, org.codehaus.plexus.util.Scanner scanner)  
      private void indexDependency​(Indexer indexer, FileSet fileSet)  
      private void indexDirectory​(Indexer indexer, FileSet fileSet)  
      private boolean isVerbose()  
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mavenProject

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

        @Parameter(defaultValue="${project.build.outputDirectory}",
                   readonly=true)
        private java.io.File classesDir
        By default, process the classes compiled for the project. If you need to process other sets of classes, such as test classes, see the fileSets parameter.
      • fileSets

        @Parameter
        private java.util.List<FileSet> fileSets
        Process the classes found in these file sets, after considering the specified includes and excludes, if any. The format is:
         <fileSets>
           <fileSet>
             <directory>path-or-expression</directory>
             <includes>
               <include>some/thing/*.good</include>
             </includes>
             <excludes>
               <exclude>some/thing/*.bad</exclude>
             </excludes>
           </fileSet>
         </fileSets>
         
        Instead of the directory element, a dependency element may be used. In that case, if the project has a corresponding dependency, classes in its artifact are processed. The dependency element must specify a groupId and an artifactId and may specify a classifier:
         <fileSets>
           <fileSet>
             <dependency>
               <groupId>com.example</groupId>
               <artifactId>my-project</artifactId>
               <classifier>tests</artifactId>
             </dependency>
             <includes>
               <include>some/thing/*.good</include>
             </includes>
             <excludes>
               <exclude>some/thing/*.bad</exclude>
             </excludes>
           </fileSet>
         </fileSets>
         
        NOTE: Standard globbing expressions are supported in includes/excludes.
      • processDefaultFileSet

        @Parameter(defaultValue="true")
        private boolean processDefaultFileSet
        If true, and if a file set rooted in the target/classes directory is not defined explicitly, an implied file set rooted in the target/classes directory will be used.
      • verbose

        @Parameter(defaultValue="false")
        private boolean verbose
        Print verbose output (debug output without needing to enable -X for the whole build).
      • indexDir

        @Parameter(defaultValue="${project.build.outputDirectory}/META-INF")
        private java.io.File indexDir
        The directory in which the index file will be created. Defaults to ${project.build.outputDirectory}/META-INF.
      • indexName

        @Parameter(defaultValue="jandex.idx")
        private java.lang.String indexName
        The name of the index file. Defaults to jandex.idx.
      • indexVersion

        @Parameter
        private java.lang.Integer indexVersion
        Persistent index format version to write. Defaults to max supported version.
      • skip

        @Parameter(property="jandex.skip",
                   defaultValue="false")
        private boolean skip
        Skip execution if set.
      • skipForPomPackaging

        @Parameter(defaultValue="true")
        private boolean skipForPomPackaging
        Skip execution if set and if the module's packaging is POM.
    • Constructor Detail

      • JandexGoal

        public JandexGoal()
    • Method Detail

      • execute

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

        private void indexDirectory​(Indexer indexer,
                                    FileSet fileSet)
                             throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • indexDependency

        private void indexDependency​(Indexer indexer,
                                     FileSet fileSet)
                              throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • findFilesToIndex

        private java.lang.String[] findFilesToIndex​(FileSet fileSet,
                                                    org.codehaus.plexus.util.Scanner scanner)
      • isVerbose

        private boolean isVerbose()