maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hervé Boutemy (JIRA) <j...@apache.org>
Subject [jira] [Updated] (MPLUGIN-321) improve documentation on maven-plugin-annotations telling that provided is sufficient
Date Sat, 24 Dec 2016 16:35:58 GMT

     [ https://issues.apache.org/jira/browse/MPLUGIN-321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Hervé Boutemy updated MPLUGIN-321:
----------------------------------
    Description: 
https://maven.apache.org/plugin-tools-archives/plugin-tools-3.5/maven-plugin-plugin/examples/using-annotations.html#POM_configuration
tells
{code:xml}  <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>
{code}

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|http://maven.apache.org/ref/3-LATEST/maven-plugin-api/]). But the
dependency is simply not used at runtime.

This doc can be improved:
{code:xml}<!-- annotations are not used at runtime, they are needed only to build the plugin
-->{code}

  was:
https://maven.apache.org/plugin-tools-archives/plugin-tools-3.5/maven-plugin-plugin/examples/using-annotations.html#POM_configuration
tells
{code:xml}  <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>
{code}

No, annotations are not needed _only_ to build the plugin (since they have {{@Retention(value=CLASS)}},
which means they stay in bytecode), and Maven core does not inject maven-plugin-annotations
at runtime (why would it? Maven core works by reading [META-INF/maven/plugin.xml|http://maven.apache.org/ref/3-LATEST/maven-plugin-api/])

Maven Plugin Tools plugin itself was fixed in MPLUGIN-296, since a change in Maven core (MRESOLVER-8/MNG-6135)
plugin dependencies resolution showed that it was working magically but should not have worked
previously...

then our recipe have to be updated to avoid people continuing to introduce this wrong magic
in their plugins...


> improve documentation on maven-plugin-annotations telling that provided is sufficient
> -------------------------------------------------------------------------------------
>
>                 Key: MPLUGIN-321
>                 URL: https://issues.apache.org/jira/browse/MPLUGIN-321
>             Project: Maven Plugin Tools
>          Issue Type: Bug
>          Components: maven-plugin-annotations
>    Affects Versions: 3.5
>            Reporter: Hervé Boutemy
>             Fix For: 3.5.1
>
>
> https://maven.apache.org/plugin-tools-archives/plugin-tools-3.5/maven-plugin-plugin/examples/using-annotations.html#POM_configuration
> tells
> {code:xml}  <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>
> {code}
> 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|http://maven.apache.org/ref/3-LATEST/maven-plugin-api/]).
But the dependency is simply not used at runtime.
> This doc can be improved:
> {code:xml}<!-- annotations are not used at runtime, they are needed only to build
the plugin -->{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message