maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject [maven-studies] 01/01: initial Maven extension demo
Date Fri, 13 Jul 2018 06:08:23 GMT
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch maven-extention-demo
in repository https://gitbox.apache.org/repos/asf/maven-studies.git

commit 612a1acb50054b5168d1c04e587e30419d137841
Author: Hervé Boutemy <hboutemy@apache.org>
AuthorDate: Fri Jul 13 08:06:19 2018 +0200

    initial Maven extension demo
---
 .gitignore                                         |  15 +++
 pom.xml                                            |  60 ++++++++++
 src/it/-Dmaven.ext.class.path/invoker.properties   |  22 ++++
 src/it/-Dmaven.ext.class.path/pom.xml              |  44 ++++++++
 src/it/mvnExtensions/.mvn/extensions.xml           |  29 +++++
 src/it/mvnExtensions/invoker.properties            |  18 +++
 src/it/mvnExtensions/pom.xml                       |  43 ++++++++
 src/it/pomExtension/invoker.properties             |  18 +++
 src/it/pomExtension/pom.xml                        |  53 +++++++++
 src/it/settings.xml                                |  55 ++++++++++
 .../apache/maven/demo/extension/EventSpyDemo.java  |  93 ++++++++++++++++
 .../demo/extension/ExecutionListenerDemo.java      | 121 +++++++++++++++++++++
 .../demo/extension/LifecycleParticipantDemo.java   |  58 ++++++++++
 13 files changed, 629 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f79c928
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,15 @@
+target/
+.project
+.classpath
+.settings/
+.svn/
+bin/
+# Intellij
+*.ipr
+*.iml
+.idea
+out/
+.DS_Store
+/bootstrap
+/dependencies.xml
+.java-version
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..24fa381
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-plugins</artifactId>
+    <version>31</version>
+  </parent>
+
+  <groupId>org.apache.maven.demo</groupId>
+  <artifactId>maven-extension-demo</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+
+  <name>maven-extension-demo</name>
+
+  <properties>
+    <mavenVersion>3.1.1</mavenVersion>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>${mavenVersion}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.11</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/src/it/-Dmaven.ext.class.path/invoker.properties b/src/it/-Dmaven.ext.class.path/invoker.properties
new file mode 100755
index 0000000..9063875
--- /dev/null
+++ b/src/it/-Dmaven.ext.class.path/invoker.properties
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.mavenOpts=-Dmaven.ext.class.path=${project.basedir}/target/local-repo/org/apache/maven/demo/${project.artifactId}/${project.version}/${project.build.finalName}.jar

+invoker.goals=clean verify
+
+# -Dmaven.ext.class.path feature added in Maven 3.0.2 with MNG-4936
+invoker.maven.version = 3.0.2+
diff --git a/src/it/-Dmaven.ext.class.path/pom.xml b/src/it/-Dmaven.ext.class.path/pom.xml
new file mode 100755
index 0000000..a99bd86
--- /dev/null
+++ b/src/it/-Dmaven.ext.class.path/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project
+  xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven-parent</artifactId>
+    <version>31</version>
+  </parent>
+
+  <groupId>demo.it</groupId>
+  <artifactId>mavenOpts</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <name>Activate extension with -Dmaven.ext.class.path=extension.jar</name>
+  <description>-Dmaven.ext.class.path feature added in Maven 3.0.2 with MNG-4936</description>
+
+  <properties>
+    <rat.skip>true</rat.skip>
+  </properties>
+</project>
diff --git a/src/it/mvnExtensions/.mvn/extensions.xml b/src/it/mvnExtensions/.mvn/extensions.xml
new file mode 100644
index 0000000..02de88c
--- /dev/null
+++ b/src/it/mvnExtensions/.mvn/extensions.xml
@@ -0,0 +1,29 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
+  <extension>
+    <groupId>@project.groupId@</groupId>
+    <artifactId>@project.artifactId@</artifactId>
+    <version>@project.version@</version>
+  </extension>
+</extensions>
diff --git a/src/it/mvnExtensions/invoker.properties b/src/it/mvnExtensions/invoker.properties
new file mode 100755
index 0000000..d9a77de
--- /dev/null
+++ b/src/it/mvnExtensions/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.goals=clean verify
diff --git a/src/it/mvnExtensions/pom.xml b/src/it/mvnExtensions/pom.xml
new file mode 100755
index 0000000..9f78ada
--- /dev/null
+++ b/src/it/mvnExtensions/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project
+  xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven-parent</artifactId>
+    <version>31</version>
+  </parent>
+
+  <groupId>demo.it</groupId>
+  <artifactId>mvn-extension</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <name>Activate extension with .mvn/extensions.xml</name>
+
+  <properties>
+    <rat.skip>true</rat.skip>
+  </properties>
+</project>
diff --git a/src/it/pomExtension/invoker.properties b/src/it/pomExtension/invoker.properties
new file mode 100755
index 0000000..d9a77de
--- /dev/null
+++ b/src/it/pomExtension/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.goals=clean verify
diff --git a/src/it/pomExtension/pom.xml b/src/it/pomExtension/pom.xml
new file mode 100755
index 0000000..aa7bb88
--- /dev/null
+++ b/src/it/pomExtension/pom.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project
+  xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven-parent</artifactId>
+    <version>31</version>
+  </parent>
+
+  <groupId>demo.it</groupId>
+  <artifactId>pom-extension</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <name>Activate extension with pom.xml build/extensions</name>
+
+  <properties>
+    <rat.skip>true</rat.skip>
+  </properties>
+
+  <build>
+    <extensions>
+      <extension>
+        <groupId>@project.groupId@</groupId>
+        <artifactId>@project.artifactId@</artifactId>
+        <version>@project.version@</version>
+      </extension>
+    </extensions>
+  </build>
+</project>
diff --git a/src/it/settings.xml b/src/it/settings.xml
new file mode 100644
index 0000000..c8f77f0
--- /dev/null
+++ b/src/it/settings.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<settings>
+  <profiles>
+    <profile>
+      <id>it-repo</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <repositories>
+        <repository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+</settings>
diff --git a/src/main/java/org/apache/maven/demo/extension/EventSpyDemo.java b/src/main/java/org/apache/maven/demo/extension/EventSpyDemo.java
new file mode 100644
index 0000000..3d68d60
--- /dev/null
+++ b/src/main/java/org/apache/maven/demo/extension/EventSpyDemo.java
@@ -0,0 +1,93 @@
+package org.apache.maven.demo.extension;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.eventspy.AbstractEventSpy;
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.classworlds.ClassWorld;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+
+/**
+ * Event Spy demo (since Maven 3.0.2, with <a href="https://issues.apache.org/jira/browse/MNG-4936">MNG-4936</a>).
+ * Notice: event spies are not activated from POM build extensions.
+ */
+@Named( "demo" )
+@Singleton
+public class EventSpyDemo
+    extends AbstractEventSpy
+{
+    private Map<String, Integer> events = new HashMap<String, Integer>();
+
+    private DefaultPlexusContainer container;
+
+    public void init( Context context )
+        throws Exception
+    {
+        System.err.println( "EventSpyDemo init:" );
+        for ( Map.Entry<String, Object> entry : context.getData().entrySet() )
+        {
+            System.err.println( "EventSpyDemo init context: - " + entry.getKey() + " = "
+ entry.getValue() );
+        }
+        container = (DefaultPlexusContainer) context.getData().get( "plexus" );
+        dump( container.getClassWorld() );
+    }
+
+    public void onEvent( Object event )
+        throws Exception
+    {
+        //System.err.println( "EventSpyDemo onEvent: " + event );
+        Integer count = events.get( event.getClass().getName() );
+        if ( count == null )
+        {
+            count = 1;
+        }
+        else
+        {
+            count++;
+        }
+        events.put( event.getClass().getName(), count );
+    }
+
+    public void close()
+        throws Exception
+    {
+        System.err.println( "EventSpyDemo close" );
+        for ( Map.Entry<String, Integer> entry : events.entrySet() )
+        {
+            System.err.println( "EventSpyDemo - " + entry.getValue() + " " + entry.getKey()
);
+        }
+        dump( container.getClassWorld() );
+    }
+
+    private void dump( ClassWorld cw )
+    {
+        for ( ClassRealm cr : cw.getRealms() )
+        {
+            System.err.println( "EventSpyDemo - ClassRealm " + cr.getId() );
+            cr.display( System.err );
+        }
+    }
+}
diff --git a/src/main/java/org/apache/maven/demo/extension/ExecutionListenerDemo.java b/src/main/java/org/apache/maven/demo/extension/ExecutionListenerDemo.java
new file mode 100644
index 0000000..ef6afd5
--- /dev/null
+++ b/src/main/java/org/apache/maven/demo/extension/ExecutionListenerDemo.java
@@ -0,0 +1,121 @@
+package org.apache.maven.demo.extension;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.execution.AbstractExecutionListener;
+import org.apache.maven.execution.ExecutionEvent;
+
+/**
+ * Execution Listener demo.
+ * <b>Question:</b> how to inject it to Maven runtime?
+ */
+@Named( "demo" )
+@Singleton
+public class ExecutionListenerDemo
+    extends AbstractExecutionListener
+{
+    public void projectDiscoveryStarted( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo projectDiscoveryStarted" );
+    }
+
+    public void sessionStarted( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo sessionStarted" );
+    }
+
+    public void sessionEnded( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo sessionEnded" );
+    }
+
+    public void projectSkipped( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo projectSkipped" );
+    }
+
+    public void projectStarted( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo projectStarted" );
+    }
+
+    public void projectSucceeded( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo projectSucceeded" );
+    }
+
+    public void projectFailed( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo projectFailed" );
+    }
+
+    public void forkStarted( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo forkStarted" );
+    }
+
+    public void forkSucceeded( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo forkSucceeded" );
+    }
+
+    public void forkFailed( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo forkFailed" );
+    }
+
+    public void mojoSkipped( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo mojoSkipped" );
+    }
+
+    public void mojoStarted( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo mojoStarted" );
+    }
+
+    public void mojoSucceeded( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo mojoSucceeded" );
+    }
+
+    public void mojoFailed( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo mojoFailed" );
+    }
+
+    public void forkedProjectStarted( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo forkedProjectStarted" );
+    }
+
+    public void forkedProjectSucceeded( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo forkedProjectSucceeded" );
+    }
+
+    public void forkedProjectFailed( ExecutionEvent event )
+    {
+        System.err.println( "ExecutionListenerDemo forkedProjectFailed" );
+    }
+}
diff --git a/src/main/java/org/apache/maven/demo/extension/LifecycleParticipantDemo.java b/src/main/java/org/apache/maven/demo/extension/LifecycleParticipantDemo.java
new file mode 100644
index 0000000..aea3cc9
--- /dev/null
+++ b/src/main/java/org/apache/maven/demo/extension/LifecycleParticipantDemo.java
@@ -0,0 +1,58 @@
+package org.apache.maven.demo.extension;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.AbstractMavenLifecycleParticipant;
+import org.apache.maven.MavenExecutionException;
+import org.apache.maven.execution.MavenSession;
+
+/**
+ * Lifecycle Participant demo (feature added in Maven 3.0-alpha-3 with
+ * <a href="https://issues.apache.org/jira/browse/MNG-4224">MNG-4224</a>.
+ */
+@Named( "demo" )
+@Singleton
+public class LifecycleParticipantDemo
+    extends AbstractMavenLifecycleParticipant
+{
+    public void afterProjectsRead( MavenSession session )
+        throws MavenExecutionException
+    {
+        System.err.println( "LifecycleParticipantDemo afterProjectsRead" );
+    }
+
+    public void afterSessionStart( MavenSession session )
+        throws MavenExecutionException
+    {
+        System.err.println( "LifecycleParticipantDemo afterSessionStart" );
+    }
+
+    /*
+    * @since 3.2.1, MNG-5389
+    */
+   public void afterSessionEnd( MavenSession session )
+       throws MavenExecutionException
+   {
+       System.err.println( "LifecycleParticipantDemo afterSessionEnd" );
+   }
+}


Mime
View raw message