1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.maven; 20 21 import org.apache.maven.execution.MavenSession; 22 23 /** 24 * Allows core extensions to participate in Maven build session lifecycle. 25 * 26 * All callback methods (will) follow beforeXXX/afterXXX naming pattern to 27 * indicate at what lifecycle point it is being called. 28 * 29 * @see <a href="https://maven.apache.org/examples/maven-3-lifecycle-extensions.html">example</a> 30 * @see <a href="https://issues.apache.org/jira/browse/MNG-4224">MNG-4224</a> 31 * @since 3.0-alpha-3 32 */ 33 public abstract class AbstractMavenLifecycleParticipant { 34 35 /** 36 * Invoked after all MavenProject instances have been created. 37 * 38 * This callback is intended to allow extensions to manipulate MavenProjects 39 * before they are sorted and actual build execution starts. 40 */ 41 public void afterProjectsRead(MavenSession session) throws MavenExecutionException { 42 // do nothing 43 } 44 45 /** 46 * Invoked after MavenSession instance has been created. 47 * 48 * This callback is intended to allow extensions to inject execution properties, 49 * activate profiles and perform similar tasks that affect MavenProject 50 * instance construction. 51 */ 52 // TODO This is too early for build extensions, so maybe just remove it? 53 public void afterSessionStart(MavenSession session) throws MavenExecutionException { 54 // do nothing 55 } 56 57 /** 58 * Invoked after all projects were built. 59 * 60 * This callback is intended to allow extensions to perform cleanup of any 61 * allocated external resources after the build. It is invoked on best-effort 62 * basis and may be missed due to an Error or RuntimeException in Maven core 63 * code. 64 * @since 3.2.1, MNG-5389 65 */ 66 public void afterSessionEnd(MavenSession session) throws MavenExecutionException { 67 // do nothing 68 } 69 }