Repository: maven
Updated Branches:
  refs/heads/master 8ae1a3e92 -> 6755560a7


[MNG-6084] Support JSR 250 @PreDestory and @PostContruct


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/582ca659
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/582ca659
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/582ca659

Branch: refs/heads/master
Commit: 582ca6591ee9d2ed1de5ea58d10cba19cb8baf1d
Parents: 38300cf
Author: dantran <dant...@apache.org>
Authored: Sun Sep 11 21:07:39 2016 -0700
Committer: Dan Tran <dan.t...@emc.com>
Committed: Sun Nov 20 09:20:19 2016 -0800

----------------------------------------------------------------------
 .../src/main/resources/META-INF/maven/extension.xml    |  9 ++++++---
 maven-embedder/pom.xml                                 |  4 ++++
 .../src/main/java/org/apache/maven/cli/MavenCli.java   | 13 +++++++------
 pom.xml                                                |  5 +++++
 4 files changed, 22 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/582ca659/maven-core/src/main/resources/META-INF/maven/extension.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/main/resources/META-INF/maven/extension.xml 
b/maven-core/src/main/resources/META-INF/maven/extension.xml
index f9cf07a..eaa807b 100644
--- a/maven-core/src/main/resources/META-INF/maven/extension.xml
+++ b/maven-core/src/main/resources/META-INF/maven/extension.xml
@@ -98,8 +98,10 @@ under the License.
     <exportedPackage>javax.enterprise.util.*</exportedPackage>
     <exportedPackage>javax.enterprise.inject.*</exportedPackage>
 
+    <!-- javax.annotation (JSR-250) -->
+    <exportedPackage>javax.annotation.*</exportedPackage>
 
-    <!-- 
+    <!--
       | We may potentially want to export these, but right now I'm not sure 
that anything Guice specific needs
       | to be made available to plugin authors. If we find people are getting 
fancy and want to take advantage of
       | Guice specifics we can expose that later. Really some testing needs to 
be done to see full hiding
@@ -157,11 +159,12 @@ under the License.
     <exportedArtifact>org.eclipse.aether:aether-impl</exportedArtifact>
 
     <exportedArtifact>javax.inject:javax.inject</exportedArtifact>
+    <exportedArtifact>javax.annotation:jsr250-api</exportedArtifact>
     <exportedArtifact>org.slf4j:slf4j-api</exportedArtifact>
     <exportedArtifact>org.fusesource.jansi:jansi</exportedArtifact>
 
     <!--
-      | We must also filter out the old Aether or NoClassDefFoundErrors will 
surface  
+      | We must also filter out the old Aether or NoClassDefFoundErrors will 
surface
      -->
     <exportedArtifact>org.sonatype.aether:aether-api</exportedArtifact>
     <exportedArtifact>org.sonatype.aether:aether-spi</exportedArtifact>
@@ -171,7 +174,7 @@ under the License.
       | NOTE: Don't exclude the wagons or any of their dependencies (apart 
from the wagon API). This would otherwise
       | provoke linkage errors for wagons contributed by build extensions. We 
also don't need to exclude the wagons
       | from plugins. Plugins that use wagons directly and declare the 
corresponding dependency will simply use a
-      | wagon from their plugin realm. 
+      | wagon from their plugin realm.
      -->
   </exportedArtifacts>
 </extension>

http://git-wip-us.apache.org/repos/asf/maven/blob/582ca659/maven-embedder/pom.xml
----------------------------------------------------------------------
diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml
index f9973c5..db1bb34 100644
--- a/maven-embedder/pom.xml
+++ b/maven-embedder/pom.xml
@@ -101,6 +101,10 @@ under the License.
       <artifactId>javax.inject</artifactId>
     </dependency>
     <dependency>
+      <groupId>javax.annotation</groupId>
+      <artifactId>jsr250-api</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-component-annotations</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/maven/blob/582ca659/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java 
b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 822f696..8f9546c 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -582,9 +582,9 @@ public class MavenCli
 
         ClassRealm containerRealm = setupContainerRealm( 
cliRequest.classWorld, coreRealm, extClassPath, extensions );
 
-        ContainerConfiguration cc = new 
DefaultContainerConfiguration().setClassWorld( cliRequest.classWorld ).setRealm(
-            containerRealm ).setClassPathScanning( 
PlexusConstants.SCANNING_INDEX ).setAutoWiring( true ).setName(
-            "maven" );
+        ContainerConfiguration cc = new 
DefaultContainerConfiguration().setClassWorld( cliRequest.classWorld ).
+            setRealm( containerRealm ).setClassPathScanning( 
PlexusConstants.SCANNING_INDEX ).setAutoWiring( true ).
+            setJSR250Lifecycle( true ).setName( "maven" );
 
         Set<String> exportedArtifacts = new HashSet<>( 
coreEntry.getExportedArtifacts() );
         Set<String> exportedPackages = new HashSet<>( 
coreEntry.getExportedPackages() );
@@ -680,6 +680,7 @@ public class MavenCli
                 .setRealm( containerRealm ) //
                 .setClassPathScanning( PlexusConstants.SCANNING_INDEX ) //
                 .setAutoWiring( true ) //
+                .setJSR250Lifecycle( true ) //enable support for 
@PostConstruct and @PreDestroy
                 .setName( "maven" );
 
             DefaultPlexusContainer container = new DefaultPlexusContainer( cc, 
new AbstractModule()
@@ -1671,14 +1672,14 @@ public class MavenCli
         if ( commandLine.hasOption( CLIManager.SET_SYSTEM_PROPERTY ) )
         {
             String[] defStrs = commandLine.getOptionValues( 
CLIManager.SET_SYSTEM_PROPERTY );
-            
+
             if ( defStrs != null )
             {
                 //The following is needed to get precedence
                 //of properties which are defined on command line
-                //over properties defined in the .mvn/maven.config. 
+                //over properties defined in the .mvn/maven.config.
                 ArrayUtils.reverse( defStrs );
-                
+
                 for ( String defStr : defStrs )
                 {
                     setCliProperty( defStr, userProperties );

http://git-wip-us.apache.org/repos/asf/maven/blob/582ca659/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 861b915..24c7df6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -266,6 +266,11 @@ under the License.
         <version>1</version>
       </dependency>
       <dependency>
+        <groupId>javax.annotation</groupId>
+        <artifactId>jsr250-api</artifactId>
+        <version>1.0</version>
+      </dependency>
+      <dependency>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-component-annotations</artifactId>
         <version>${plexusVersion}</version>

Reply via email to