You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Dave Moten (JIRA)" <ji...@codehaus.org> on 2014/04/29 13:28:10 UTC
[jira] (MNG-5520) RuntimePolicy is incorrect for
org.apache.maven.plugins.annotations.Parameter
[ https://jira.codehaus.org/browse/MNG-5520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=345550#comment-345550 ]
Dave Moten commented on MNG-5520:
---------------------------------
I'm interested in creating tooling with maven plugins. In particular to enable type safe parameter methods for a maven plugin to be called from java code. To this end I look at a plugin like maven-dependency-plugin and I encounter the plugin.xml fragment below. There is insufficient structured information in the xml to figure out for instance that the parameter corresponds to a List<ArtifactItem>. Given that the plugin.xml does not completely describe the configuration of the plugin the only alternative is to scan annotations. Given that they are set as RetentionPolicy.CLASS I have to use bytecode analysis tools to make sense of it. I see two alternatives, use a RUNTIME retention policy or improve plugin.xml. I'm guessing a preference is held towards the second but is any change planned in this regard?
<parameter>
<name>artifactItems</name>
<type>java.util.List</type>
<since>1.0</since>
<required>false</required>
<editable>true</editable>
<description>Collection of ArtifactItems to work on. (ArtifactItem contains groupId, artifactId, version, type, classifier,
outputDirectory, destFileName and overWrite.) See <a href="./usage.html">Usage</a> for details.</description>
</parameter>
> RuntimePolicy is incorrect for org.apache.maven.plugins.annotations.Parameter
> -----------------------------------------------------------------------------
>
> Key: MNG-5520
> URL: https://jira.codehaus.org/browse/MNG-5520
> Project: Maven 2 & 3
> Issue Type: Bug
> Components: Plugin API
> Affects Versions: 3.0.4
> Environment: JDK 1.7
> MAVN 3.0.5
> Reporter: Martin Gainty
> Priority: Minor
> Attachments: RobertPatrickAnnotationsTest.zip
>
>
> looks like we need to hire you to check our code..(provided you work for free)
> package org.apache.maven.plugins.annotations;
> import java.lang.annotation.RetentionPolicy;
> @Documented
> @Retention( RetentionPolicy.CLASS )
> @Target( { ElementType.FIELD } )
> @Inherited
> public @interface Parameter
> RetentionPolicy parameters:
> CLASS
> Annotations are to be recorded in the class file by the compiler but need NOT be retained by the VM at run time.
>
> RUNTIME
> Annotations are to be recorded in the class file by the compiler and RETAINED by the VM at run time, so they may be read reflectively.
>
> SOURCE
> Annotations are to be discarded by the compiler.
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)