View Javadoc
1   package org.apache.maven.demo.extension;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import javax.inject.Named;
23  import javax.inject.Singleton;
24  
25  import org.apache.maven.AbstractMavenLifecycleParticipant;
26  import org.apache.maven.MavenExecutionException;
27  import org.apache.maven.execution.MavenSession;
28  
29  /**
30   * Lifecycle Participant demo (feature added in Maven 3.0-alpha-3 with
31   * <a href="https://issues.apache.org/jira/browse/MNG-4224">MNG-4224</a>).
32   * defined with <a href="/maven-jsr330.html">JSR-330 javax.inject annotations</a>.
33   * Notice: such JSR-330 annotations do not work on Maven 3.0.x, but only starting with 3.1
34   */
35  @Named( "demo-jsr330" )
36  @Singleton
37  public class LifecycleParticipantDemoJsr330
38      extends AbstractMavenLifecycleParticipant
39  {
40      public void afterProjectsRead( MavenSession session )
41          throws MavenExecutionException
42      {
43          System.err.println( "LifecycleParticipantDemoJsr330 afterProjectsRead" );
44      }
45  
46      public void afterSessionStart( MavenSession session )
47          throws MavenExecutionException
48      {
49          System.err.println( "LifecycleParticipantDemoJsr330 afterSessionStart" );
50      }
51  
52      /*
53      * @since 3.2.1, MNG-5389
54      */
55     public void afterSessionEnd( MavenSession session )
56         throws MavenExecutionException
57     {
58         System.err.println( "LifecycleParticipantDemoJsr330 afterSessionEnd" );
59     }
60  }