Uploaded image for project: 'Maven Plugin Tools'
  1. Maven Plugin Tools
  2. MPLUGIN-321

improve documentation on maven-plugin-annotations telling that optional=true is sufficient

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.5
    • 3.5.1
    • None

    Description

      https://maven.apache.org/plugin-tools-archives/plugin-tools-3.5/maven-plugin-plugin/examples/using-annotations.html#POM_configuration
      tells

        <dependencies>
          <!-- dependencies to annotations -->
          <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>3.5</version>
            <scope>provided</scope><!-- annotations are needed only to build the plugin -->
          </dependency>
        </dependencies>
      

      Yes, annotations are needed only to build the plugin, since they have @Retention(value=CLASS) which means they stay in bytecode but are not loaded at runtime.
      What is not clear is that this dependency is not really provided at runtime: Maven core does not inject maven-plugin-annotations at runtime (why would it? Maven core works by reading META-INF/maven/plugin.xml). But the dependency is simply not used at runtime.

      This doc can be improved:

      <!-- annotations are not used at runtime because @Retention(value=CLASS), they are needed only to build the plugin -->

      Attachments

        Issue Links

          Activity

            People

              rfscholte Robert Scholte
              hboutemy Herve Boutemy
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: