[ 
https://issues.apache.org/jira/browse/MNG-6084?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15482791#comment-15482791
 ] 

Stuart McCulloch commented on MNG-6084:
---------------------------------------

Support for JSR250 lifecycle annotations can be enabled in the 
{{ContainerConfiguration}}, configured in
{{maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java}}:
{code}
ContainerConfiguration cc = new DefaultContainerConfiguration()
    .setClassWorld( cliRequest.classWorld )
    .setRealm( containerRealm )
    .setClassPathScanning( PlexusConstants.SCANNING_INDEX )
    .setAutoWiring( true )
    .setJSR250Lifecycle( true )        // <--- enable support for 
@PostConstruct and @PreDestroy
    .setName( "maven" );
{code}
You may also want to add {{javax.annotation}} to the list of packages exported 
to plugins from Maven core, defined in
{{maven-core/src/main/resources/META-INF/maven/extension.xml}}:
{code}
<!-- javax.annotation (JSR-250) -->
<exportedPackage>javax.annotation.*</exportedPackage>
{code}
otherwise it will use the package from the current JRE, which might not have it 
(ie. Java 7 and earlier) or might hide it by default (Jigsaw)

> Support JSR250 annotations
> --------------------------
>
>                 Key: MNG-6084
>                 URL: https://issues.apache.org/jira/browse/MNG-6084
>             Project: Maven
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 3.3.9
>            Reporter: Dan Tran
>
> JSR330 ( @Named, @Singeton, etc) currently supported for plugin development.  
> Would like to see JSR250 as well(@PostConstruct, etc)
> Detail discussion is at  
> http://maven.40175.n5.nabble.com/Maven-Plugin-and-JSR330-td5879508.html



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

Reply via email to