Class IndexMojo

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

    @Mojo(name="index",
          requiresDependencyResolution=TEST,
          threadSafe=true)
    public class IndexMojo
    extends org.apache.maven.plugin.AbstractMojo
    Generates a qualified class index for the current project and its dependencies.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.sonatype.plexus.build.incremental.BuildContext buildContext
      For m2e incremental build support
      protected java.lang.String excludeArtifactIds
      Comma separated list of ArtifactIds to exclude when indexing.
      protected java.lang.String excludeClassifiers
      Comma Separated list of Classifiers to exclude when indexing.
      protected java.lang.String excludeGroupIds
      Comma separated list of GroupIds to exclude when indexing.
      protected java.lang.String excludeScope
      Scope to exclude.
      protected boolean excludeTransitive
      If we should exclude transitive dependencies when indexing.
      protected java.lang.String excludeTypes
      Comma Separated list of Types to exclude when indexing.
      protected java.lang.String includeArtifactIds
      Comma separated list of ArtifactIds to include when indexing.
      protected java.lang.String includeClassifiers
      Comma Separated list of Classifiers to include when indexing.
      protected boolean includeDependencies
      If we should include project dependencies when indexing.
      protected java.lang.String includeGroupIds
      Comma separated list of GroupIds to include when indexing.
      protected java.lang.String includeScope
      Scope to include.
      protected java.lang.String includeTypes
      Comma Separated list of Types to include when indexing.
      (package private) static java.lang.String INDEX_FOLDER  
      protected java.io.File outputDirectory
      The output directory.
      private org.apache.maven.project.MavenProject project
      The Maven project to index.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      IndexMojo()  
      IndexMojo​(org.sonatype.plexus.build.incremental.BuildContext buildContext)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void appendDirectoryToClassPath​(java.util.List<java.net.URL> urls, java.io.File directory)  
      private void appendFileToClassPath​(java.util.List<java.net.URL> urls, java.io.File file)  
      private static java.lang.String cleanList​(java.lang.String list)  
      private void dumpEntries​(java.lang.String name, java.util.List<java.net.URL> urls)  
      void execute()  
      private java.net.URL[] getIndexPath()  
      private java.lang.ClassLoader getProjectClassLoader()  
      void setOutputDirectory​(java.io.File outputDirectory)  
      void setProject​(org.apache.maven.project.MavenProject project)  
      • 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

      • outputDirectory

        @Parameter(property="outputDirectory",
                   defaultValue="${project.build.outputDirectory}")
        protected java.io.File outputDirectory
        The output directory.
      • includeDependencies

        @Parameter(property="includeDependencies",
                   defaultValue="true")
        protected boolean includeDependencies
        If we should include project dependencies when indexing.
      • excludeGroupIds

        @Parameter(property="excludeGroupIds",
                   defaultValue="")
        protected java.lang.String excludeGroupIds
        Comma separated list of GroupIds to exclude when indexing.
      • includeGroupIds

        @Parameter(property="includeGroupIds",
                   defaultValue="")
        protected java.lang.String includeGroupIds
        Comma separated list of GroupIds to include when indexing.
      • excludeArtifactIds

        @Parameter(property="excludeArtifactIds",
                   defaultValue="")
        protected java.lang.String excludeArtifactIds
        Comma separated list of ArtifactIds to exclude when indexing.
      • includeArtifactIds

        @Parameter(property="includeArtifactIds",
                   defaultValue="")
        protected java.lang.String includeArtifactIds
        Comma separated list of ArtifactIds to include when indexing.
      • excludeClassifiers

        @Parameter(property="excludeClassifiers",
                   defaultValue="")
        protected java.lang.String excludeClassifiers
        Comma Separated list of Classifiers to exclude when indexing.
      • includeClassifiers

        @Parameter(property="includeClassifiers",
                   defaultValue="")
        protected java.lang.String includeClassifiers
        Comma Separated list of Classifiers to include when indexing.
      • excludeTypes

        @Parameter(property="excludeTypes",
                   defaultValue="")
        protected java.lang.String excludeTypes
        Comma Separated list of Types to exclude when indexing.
      • includeTypes

        @Parameter(property="includeTypes",
                   defaultValue="")
        protected java.lang.String includeTypes
        Comma Separated list of Types to include when indexing.
      • excludeScope

        @Parameter(property="excludeScope",
                   defaultValue="")
        protected java.lang.String excludeScope
        Scope to exclude. Empty string indicates no scopes (default).
      • includeScope

        @Parameter(property="includeScope",
                   defaultValue="")
        protected java.lang.String includeScope
        Scope to include. Empty string indicates all scopes (default).
      • excludeTransitive

        @Parameter(property="excludeTransitive",
                   defaultValue="false")
        protected boolean excludeTransitive
        If we should exclude transitive dependencies when indexing.
      • project

        @Parameter(property="project",
                   required=true,
                   readonly=true)
        private org.apache.maven.project.MavenProject project
        The Maven project to index.
      • buildContext

        @Component
        protected org.sonatype.plexus.build.incremental.BuildContext buildContext
        For m2e incremental build support
    • Constructor Detail

      • IndexMojo

        public IndexMojo()
      • IndexMojo

        public IndexMojo​(org.sonatype.plexus.build.incremental.BuildContext buildContext)
    • Method Detail

      • setProject

        public void setProject​(org.apache.maven.project.MavenProject project)
      • setOutputDirectory

        public void setOutputDirectory​(java.io.File outputDirectory)
      • execute

        public void execute()
      • getProjectClassLoader

        private java.lang.ClassLoader getProjectClassLoader()
      • getIndexPath

        private java.net.URL[] getIndexPath()
      • dumpEntries

        private void dumpEntries​(java.lang.String name,
                                 java.util.List<java.net.URL> urls)
      • appendDirectoryToClassPath

        private void appendDirectoryToClassPath​(java.util.List<java.net.URL> urls,
                                                java.io.File directory)
      • appendFileToClassPath

        private void appendFileToClassPath​(java.util.List<java.net.URL> urls,
                                           java.io.File file)
        Parameters:
        urls - the list to which to append the URL
        file - must either be a directory or a JAR file
      • cleanList

        private static java.lang.String cleanList​(java.lang.String list)