why do i need thrift to build flume? - hadoop

i have downloaded flume from "https://github.com/apache/flume/downloads"..but i am unable to build it..do i need to install thrift first in order to build flume??if so, what is the reson..i am getting following error when i run mvn compile -
mohammad#ubuntu:~/apache-flume-b01a760$ mvn compile
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] Flume
[INFO] Flume Core
[INFO] Flume Master Config Web Application
[INFO] Flume Node Web
[INFO] Flume Distribution Project
[INFO] A log4j appender for Flume
[INFO] Flume Hello World Plugin
[INFO] Flume HBase Plugin
[INFO] ------------------------------------------------------------------------
[INFO] Building Flume
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] No goals needed for project - skipping
[INFO] ------------------------------------------------------------------------
[INFO] Building Flume Core
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [antlr3:antlr {execution: default}]
[INFO] ANTLR: Processing source directory /home/mohammad/apache-flume-b01a760/flume-core/src/main/antlr3
ANTLR Parser Generator Version 3.2 Sep 23, 2009 14:05:07
com/cloudera/flume/conf/FlumeDeploy.g
com/cloudera/flume/shell/antlr/FlumeShell.g
[INFO] [antrun:run {execution: generate-version-file}]
[INFO] Executing tasks
main:
[copy] Copying 1 file to /home/mohammad/apache-flume-b01a760/flume-core/target/generated-sources/version/com/cloudera/flume
[INFO] Executed tasks
[INFO] [avro:idl-protocol {execution: default}]
[INFO] [thrift:compile {execution: default}]
[ERROR] thrift failed output:
[ERROR] thrift failed error: /bin/sh: null/bin/thrift: not found
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] thrift did not exit cleanly. Review output for more information.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 seconds
[INFO] Finished at: Mon Jun 04 16:10:47 IST 2012
[INFO] Final Memory: 28M/243M
[INFO] ------------------------------------------------------------------------

Flume has some code generation that utilizes thrift as a transport communications serialization mechanism.
In the flume-core/pom.xml, you can see this:
<plugin>
<groupId>org.apache.thrift.tools</groupId>
<artifactId>maven-thrift-plugin</artifactId>
<version>0.1.10</version>
<configuration>
<thriftExecutable>${thrift.executable}</thriftExecutable>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
You need to install thrift, and then configure the location in the parent pom.xml:
<properties>
<!-- NB: The version of the thrift compiler must match that of the dependency
on the jar file below. -->
<thrift.executable>${env.THRIFT_HOME}/bin/thrift</thrift.executable>
<!-- Set default encoding to UTF-8 to remove maven complaints -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- defaults for flaky test and focused test exclusions -->
<test.exclude.pattern>$</test.exclude.pattern> <!-- junk pattern -->
<test.include.pattern>**/Test*.java</test.include.pattern>
</properties>

Related

Build with frontend-maven-plugin fails on mac M1: Could not download Node.js

The frontend-maven-plugin tries to download a node file which does not exist.
When I look into https://nodejs.org/dist/v10.15.3 I can only see a file named node-v10.15.3-darwin-x64.tar.gz
[INFO] --- frontend-maven-plugin:1.7.5:install-node-and-npm (install node and npm) # oauth-ui-authorization-code-angular-zuul ---
[INFO] Installing node version v10.15.3
[INFO] Downloading https://nodejs.org/dist/v10.15.3/node-v10.15.3-darwin-arm64.tar.gz to /Users/me/.m2/repository/com/github/eirslett/node/10.15.3/node-10.15.3-darwin-arm64.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] mymodule 2.2.6.RELEASE FAILURE [ 4.536 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36.930 s
[INFO] Finished at: 2022-09-28T14:28:09+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.7.5:install-node-and-npm (install node and npm) on project mymodule: Could not download Node.js: Got error code 404 from the server. -> [Help 1]
[ERROR]
This is a bug in the frontend-maven-plugin.
An upgrade to the current version should help:
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.12.1</version>
...
Thanks to:
https://github.com/apache/druid/issues/10804
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/m1-mac-cant-build-wknd-tutorial-get-quot-could-not-download-node/m-p/399462

A simple example about Maven from a textbook

I am using Apache Maven 3.6.0.
I'm studying a book on Maven, namely this one:
https://books.sonatype.com/mvnex-book/pdf/mvnex-pdf.pdf. Page 7 / 155.
We are given a Sample Maven pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.sonatype.mavenbook</groupId>
<artifactId>my-project</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
Then it is written that we should run:
mvn install
I tried, it is OK. Target directory is created.
Then it is written: "Without modification, you can run mvn site".
I did that and get this: https://pastebin.com/9Zrmws9T
Well, it seems that something has to do with maven-site-plugin. But I don't know what this means for me, or whether the book is worth reading, given that it turns such somersaults at the very beginning.
Can I fix this problem with Maven?
Best way to learn maven is to start.
Let maven create an example project from an archetype:
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=RELEASE
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.0.0:generate (default-cli) > generate-sources # standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.0.0:generate (default-cli) < generate-sources # standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.0.0:generate (default-cli) # standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository not defined. Using the one from [org.apache.maven.archetypes:maven-archetype-quickstart:1.4] found in catalog remote
Define value for property 'groupId': com.essexboy
Define value for property 'artifactId': site-example
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' com.essexboy: :
Confirm properties configuration:
groupId: com.essexboy
artifactId: site-example
version: 1.0-SNAPSHOT
package: com.essexboy
Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: maven-archetype-quickstart:RELEASE
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.essexboy
[INFO] Parameter: artifactId, Value: site-example
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.essexboy
[INFO] Parameter: packageInPathFormat, Value: com/essexboy
[INFO] Parameter: package, Value: com.essexboy
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.essexboy
[INFO] Parameter: artifactId, Value: site-example
[INFO] Project created from Archetype in dir: /home/greg/work/site-example
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24.041 s
[INFO] Finished at: 2020-09-30T11:40:30+01:00
[INFO] ------------------------------------------------------------------------
Change directory into your new project where you'll have a pom and some code.
greg#greg-XPS-13-9360:~/work$ cd site-example/
Run the site command
greg#greg-XPS-13-9360:~/work/site-example$ mvn site
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.essexboy:site-example >----------------------
[INFO] Building site-example 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-site-plugin:3.7.1:site (default-site) # site-example ---
[INFO] configuring report plugin org.apache.maven.plugins:maven-project-info-reports-plugin:3.0.0
[INFO] 15 reports detected for maven-project-info-reports-plugin:3.0.0: ci-management, dependencies, dependency-info, dependency-management, distribution-management, index, issue-management, licenses, mailing-lists, modules, plugin-management, plugins, scm, summary, team
[INFO] Rendering site with default locale English (en)
[INFO] Relativizing decoration links with respect to localized project URL: http://www.example.com
[INFO] Rendering content with org.apache.maven.skins:maven-default-skin:jar:1.2 skin.
[INFO] Generating "Dependencies" report --- maven-project-info-reports-plugin:3.0.0:dependencies
[INFO] Generating "Dependency Information" report --- maven-project-info-reports-plugin:3.0.0:dependency-info
[INFO] Generating "About" report --- maven-project-info-reports-plugin:3.0.0:index
[INFO] Generating "Plugin Management" report --- maven-project-info-reports-plugin:3.0.0:plugin-management
[INFO] Generating "Plugins" report --- maven-project-info-reports-plugin:3.0.0:plugins
[INFO] Generating "Summary" report --- maven-project-info-reports-plugin:3.0.0:summary
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.829 s
[INFO] Finished at: 2020-09-30T11:40:46+01:00
[INFO] ------------------------------------------------------------------------
Your site will be generated under target/site. You can open the index.html in a browser:
Yes, the example from the book didn't seem to work for me either.
However, after I added the following build/plugins section into the pom.xml, mvn site started to work for me:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</build>
Please, also take a look at this answer here:
maven-site plugins 3.3 java.lang.ClassNotFoundException: org.apache.maven.doxia.siterenderer.DocumentContent

Applying a patch at runtime in Maven

I'm trying to install Giraph 1.1 but ran into an issue. According to this thread I should apply a patch to my installation. Unfortunately, my problem stems from that. I downloaded and copied the .patch file linked in there to the source folder and added the following to the pom.xml:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-patch-plugin</artifactId>
<version>1.2</version>
<configuration>
<patches>
<patch>GIRAPH-1110.02.patch</patch>
</patches>
...
</plugins>
Unfortunately when I run Maven with:
sudo mvn -Phadoop_yarn -Dhadoop.version=2.8.1 clean package -DskipTests
it still fails with the same error as it did before:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /usr/local/giraph/giraph-core/target/munged/main/org/apache/giraph/job/GiraphJob.java:[213,11] setPingInterval(org.apache.hadoop.conf.Configuration,int) is not public in org.apache.hadoop.ipc.Client; cannot be accessed from outside package
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Giraph Parent ............................... SUCCESS [ 6.298 s]
[INFO] Apache Giraph Core ................................. FAILURE [ 9.359 s]
[INFO] Apache Giraph Examples ............................. SKIPPED
[INFO] Apache Giraph Distribution ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.062 s
[INFO] Finished at: 2018-02-06T22:53:00+02:00
[INFO] Final Memory: 51M/640M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project giraph-core: Compilation failure
[ERROR] /usr/local/giraph/giraph-core/target/munged/main/org/apache/giraph/job/GiraphJob.java:[213,11] setPingInterval(org.apache.hadoop.conf.Configuration,int) is not public in org.apache.hadoop.ipc.Client; cannot be accessed from outside package
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
which clearly shows that the issue has not been patched. When I check the file manually, I can confirm that there's no change. If I change the file manually before compilation, the changes get discarded (I'm guessing the file gets redownloaded). Also can't run the installation with offline flag since it depends on downloading some dependencies. I'm at my wits end here.
My Maven version is 3.3.9.

Maven jar signer plugin

i have a problem with jar signer plugin.
i'm in a legacy project that use an applet, all applet jar need to be signed.
first of all, i have add jar-signer plugin in each applet project.
but i need to add a common module into the applet, so i have add jarsigner plugin into this project.
i have a task maven-dependency-plugin in my web project which copy signed jar into src/main/webapp/applet
but when i compil the project i get this error:
java.lang.SecurityException: class X signer information does not match signer information of other classes in the same package.
I thinks its because in my common project(now signed) i have some Interface and in my webproject(not signed) i have the Implementation!
I don't want to sign the webproject.
so i decided to remove all jar-signer of all project and only add jar-signer plugin into web-project like this:
<plugin>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<archiveDirectory>${basedir}/src\main\webapp\applet</archiveDirectory>
<includes>
<include>**/*.jar</include>
</includes>
<excludes>
<exclude>**/*.war</exclude>
</excludes>
<keystore>${basedir}/src/main/resources/mykeystore.jks</keystore>
<alias>myalias</alias>
<storepass>mypassword</storepass>
<keypass>mypassword</keypass>
</configuration>
</plugin>
in this directory : ${basedir}/src\main\webapp\applet i have 8 jars and plugin sign 9jars as we can see:
[INFO] Webapp assembled in [5206 msecs]
[INFO] Building war: d:\MarcoPolo\SVN\CASTOR_trunk\CTR_WEB\web\target\ctrweb-02.01.00.war
[INFO] [jarsigner:sign {execution: sign}]
[INFO] 9 archive(s) processed
[INFO] [jar:jar {execution: create-classes}]
[INFO] Building jar: d:\MarcoPolo\SVN\CASTOR_trunk\CTR_WEB\web\target\ctrweb-02.01.00-classes.jar
[INFO] [install:install {execution: default-install}]
[INFO] Installing d:\MarcoPolo\SVN\CASTOR_trunk\CTR_WEB\web\target\ctrweb-02.01.00.war to D:\Users\p
[INFO] Installing d:\MarcoPolo\SVN\CASTOR_trunk\CTR_WEB\web\target\ctrweb-02.01.00-classes.jar to D:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 5 seconds
[INFO] Finished at: Thu Jul 17 11:38:19 CEST 2014
[INFO] Final Memory: 42M/142M
[INFO] ------------------------------------------------------------------------
if i open ctrweb-02.01.00.war i can see that all are signed! but i have <exclude>**/*.war</exclude>
i have try to do
mvn jarsigner:sign
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Castor - Web war
[INFO] task-segment: [jarsigner:sign]
[INFO] ------------------------------------------------------------------------
[INFO] [jarsigner:sign {execution: default-cli}]
[INFO] 8 archive(s) processed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Thu Jul 17 11:48:52 CEST 2014
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
and only 8 jars are signed.
i want to have only my jar that are in applet directory to be signed and not jar/war in other directory.
does it possible?
thanks
Answered in comments:
i try to create two jar from my project with classifier, one signed
and the other one not. And during compilation its always took the
non-signed jar and for the copy its use the signed-jar, i think it
should work – Mançaux Pierre-Alexandre Jul 17 '14 at 12:24
yes its work! i generate 2 jar, one without classifier and another one
with classifier (signed), my jarsigner plugin use tag archive to sign
only the jar with classifier signed and during compilation, jar
without classifier is used, and the jar with the classifier is copy to
the applet webapp directory. so i resolve all my problem! – Mançaux
Pierre-Alexandre Jul 17 '14 at 14:14

Creating a new phase

I am working on a project using Maven for which I need two new phases: 'analyze' and 'eval' (for different phases of data analysis). I've read all the docs I can find, and created versions of components.xml and lifecycle.xml that are as close as I can get to correct, but Maven refuses to run the new phases. (I should emphasize that I have no problem getting my plugins to work, and no problem binding them to the existing phases provided by the default lifecycle. My problem is that the new phases I create seem to be ignored by maven.) What do I need to do to get my new phases to work?
lifecycles.xml:
<lifecycles>
<lifecycle>
<id>lenskit</id>
<phases>
<phase>
<id>analyze</id>
<executions>
<execution>
<goals>
<goal>greet</goal>
</goals>
</execution>
</executions>
</phase>
<phase>
<id>validate</id>
<executions>
<execution>
<goals>
<goal>greet</goal>
</goals>
</execution>
</executions>
</phase>
</phases>
</lifecycle>
</lifecycles>
components.xml:
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>lenskit</role-hint>
<implementation>
org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
</implementation>
<configuration>
<id>lenskit</id>
<phases>
<phase>get-data</phase>
<phase>analyze</phase>
<phase>eval</phase>
</phases>
<default-phases>
<verify> org.apache.maven.plugins:maven-resources-plugin:resources </verify>
<get-data> org.riedl:hello-lenskit-plugin:greet </get-data>
<analyze> org.riedl:hello-lenskit-plugin:greet </analyze>
<eval> org.riedl:hello-lenskit-plugin:greet </eval>
<package> org.riedl:hello-lenskit-plugin:greet </package>
</default-phases>
</configuration>
</component>
</components>
</component-set>
One of the wizards on the Maven mailing list pointed me to a complete working example that does exactly what I wanted: it creates a custom lifecycle with phases named whatever you want, and lets you use that lifecycle from the maven command-line. The example is at:
https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-scm-publish-plugin
The key missing insight is that the components.xml file must have both a LifecycleMapping component and a Lifecycle component. The correct, working components.xml is below.
Note that you may only define an additional lifecycle (i.e. additional to the three default lifecycles: the build, clean and site lifecycles). The original lifecycles and their phases will always be present and you cannot include any phases with names that match an existing lifecycle in your new lifecycle, which is too bad, since it makes it more awkward to redefine a complete lifecycle for a project. Still, this is a nice step forward.
Also, remember that when you use the new lifecycle, you must mark it as an extension:
<extensions>true</extensions>
so the plugin is allowed to redefine the lifecycle. To indicate that your pom.xml should use the new lifecycle, include the lifecycle name as the "packaging" for your project.
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>lenskit</role-hint>
<implementation>
org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
</implementation>
</component>
<component>
<role>org.apache.maven.lifecycle.Lifecycle</role>
<implementation>org.apache.maven.lifecycle.Lifecycle</implementation>
<role-hint>lenskit</role-hint>
<configuration>
<id>lenskit</id>
<phases>
<phase>get-data</phase>
<phase>analyze</phase>
<phase>eval</phase>
</phases>
<default-phases>
<get-data>org.riedl:hello-lenskit-plugin:greet</get-data>
<analyze>org.riedl:hello-lenskit-plugin:greet</analyze>
<eval>org.riedl:hello-lenskit-plugin:greet</eval>
</default-phases>
</configuration>
</component>
</components>
</component-set>
There are a number of bugs in Maven that interfer with John's approach:
The following should actually be part of John's answer but my edits were confused with commenting about his approach rather than highlighting the current limitations of the approach... so here they are as a second answer :rolleyes:
This requires Maven 3.0 or newer to work. When you try to use this in Maven 2.x you will get a error such as:
$ mvn eval
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Invalid task 'eval': you must specify a valid lifecycle phase, or a goal
in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Sep 18 15:58:12 IST 2012
[INFO] Final Memory: 2M/81M
[INFO] ------------------------------------------------------------------------
At least as of Maven 3.0.4 it does not list these phases in the help text when you invoke Maven without a goal or phase:
$ mvn
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.224s
[INFO] Finished at: Tue Sep 18 16:03:20 IST 2012
[INFO] Final Memory: 2M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid
lifecycle phase or a goal in the format <plugin-prefix>:<goal> or
<plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available
lifecycle phases are: validate, initialize, generate-sources, process-sources,
generate-resources, process-resources, compile, process-classes,
generate-test-sources, process-test-sources, generate-test-resources,
process-test-resources, test-compile, process-test-classes, test,
prepare-package, package, pre-integration-test, integration-test,
post-integration-test, verify, install, deploy, pre-clean, clean, post-clean,
pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException
In a multi-module build you can end up screwed.
Consider the following two extenions modules:
Extension 1
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>fancy</role-hint>
<implementation>
org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
</implementation>
</component>
<component>
<role>org.apache.maven.lifecycle.Lifecycle</role>
<implementation>org.apache.maven.lifecycle.Lifecycle</implementation>
<role-hint>fancy</role-hint>
<configuration>
<id>fancy</id>
<phases>
<phase>fancy</phase>
</phases>
<default-phases>
<fancy>org.codehaus.mojo:rpm-maven-plugin:version</fancy>
</default-phases>
</configuration>
</configuration>
</component>
</components>
</component-set>
Extension 2
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>poncy</role-hint>
<implementation>
org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
</implementation>
</component>
<component>
<role>org.apache.maven.lifecycle.Lifecycle</role>
<implementation>org.apache.maven.lifecycle.Lifecycle</implementation>
<role-hint>poncy</role-hint>
<configuration>
<id>poncy</id>
<phases>
<phase>poncy</phase>
<phase>fancy</phase>
</phases>
<default-phases>
<poncy>org.apache.maven.plugins:maven-enforcer-plugin:display-info</poncy>
<fancy>org.codehaus.mojo:build-helper-maven-plugin:parse-version</fancy>
</default-phases>
</configuration>
</component>
</components>
</component-set>
Parent pom
<?xml version="1.0" encoding="utf-8"?>
<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>
<groupId>localdomain.localhost</groupId>
<artifactId>fancy-lifecycle-parent</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>poncy-test</module>
<module>fancy-test</module>
</modules>
</project>
Fancy-test pom
<?xml version="1.0" encoding="utf-8"?>
<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>
<groupId>localdomain.localhost</groupId>
<artifactId>fancy-test</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>fancy</packaging>
<build>
<extensions>
<extension>
<groupId>localdomain.localhost</groupId>
<artifactId>fancy-lifecycle</artifactId>
<version>0.1-SNAPSHOT</version>
</extension>
</extensions>
</build>
</project>
Poncy-test pom
<?xml version="1.0" encoding="utf-8"?>
<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>
<groupId>localdomain.localhost</groupId>
<artifactId>poncy-test</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>poncy</packaging>
<build>
<extensions>
<extension>
<groupId>localdomain.localhost</groupId>
<artifactId>poncy-lifecycle</artifactId>
<version>0.1-SNAPSHOT</version>
</extension>
</extensions>
</build>
</project>
Some tests
$ mvn -f pom.xml fancy
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] poncy-test
[INFO] fancy-test
[INFO] fancy-lifecycle-parent
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building poncy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.1.1:display-info (default-display-info) # poncy-test ---
[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.6.0_35 normalized as: 1.6.0-35
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.8.1
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:parse-version (default-parse-version) # poncy-test ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fancy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- rpm-maven-plugin:2.1-alpha-2:version (default-version) # fancy-test ---
[WARNING] rpm version string truncated to 0.1
[INFO] setting [rpm.version] property to value [0.1].
[INFO] setting [rpm.release] property to value [SNAPSHOT20120918152051].
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fancy-lifecycle-parent 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] poncy-test ........................................ SUCCESS [0.727s]
[INFO] fancy-test ........................................ SUCCESS [0.196s]
[INFO] fancy-lifecycle-parent ............................ SUCCESS [0.001s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.152s
[INFO] Finished at: Tue Sep 18 16:20:51 IST 2012
[INFO] Final Memory: 4M/81M
[INFO] ------------------------------------------------------------------------
This first test is from the parent pom and everything builds just fine. Notice that the two phases (poncy and fancy's executions are invoked for the poncy-test module but only one phase (fancy) is invoked for the fancy-test module, as you would expect.
Now try the same only with the poncy phase
$ mvn poncy
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] poncy-test
[INFO] fancy-test
[INFO] fancy-lifecycle-parent
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building poncy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.1.1:display-info (default-display-info) # poncy-test ---
[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.6.0_35 normalized as: 1.6.0-35
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.8.1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fancy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] poncy-test ........................................ SUCCESS [0.588s]
[INFO] fancy-test ........................................ FAILURE [0.033s]
[INFO] fancy-lifecycle-parent ............................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.853s
[INFO] Finished at: Tue Sep 18 16:23:27 IST 2012
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "poncy". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, fancy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
Notice that we now have a build failure because the phase is unknown for the fancy-test module.
If we build the parent and poncy-test explicitly all works just fine:
$ mvn poncy -pl :fancy-lifecycle-parent,:poncy-test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] poncy-test
[INFO] fancy-lifecycle-parent
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building poncy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.1.1:display-info (default-display-info) # poncy-test ---
[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.6.0_35 normalized as: 1.6.0-35
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.8.1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fancy-lifecycle-parent 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] poncy-test ........................................ SUCCESS [5.247s]
[INFO] fancy-lifecycle-parent ............................ SUCCESS [0.001s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.488s
[INFO] Finished at: Tue Sep 18 16:24:45 IST 2012
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------
And finally, on a positive note, if we add a jar packaging module without the extension defined into the mix, all hell does not break loose:
$ mvn fancy
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] jar-test
[INFO] poncy-test
[INFO] fancy-test
[INFO] fancy-lifecycle-parent
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building jar-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building poncy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.1.1:display-info (default-display-info) # poncy-test ---
[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.6.0_35 normalized as: 1.6.0-35
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.8.1
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:parse-version (default-parse-version) # poncy-test ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fancy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- rpm-maven-plugin:2.1-alpha-2:version (default-version) # fancy-test ---
[WARNING] rpm version string truncated to 0.1
[INFO] setting [rpm.version] property to value [0.1].
[INFO] setting [rpm.release] property to value [SNAPSHOT20120918152733].
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fancy-lifecycle-parent 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] jar-test .......................................... SUCCESS [0.001s]
[INFO] poncy-test ........................................ SUCCESS [0.809s]
[INFO] fancy-test ........................................ SUCCESS [0.198s]
[INFO] fancy-lifecycle-parent ............................ SUCCESS [0.001s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.244s
[INFO] Finished at: Tue Sep 18 16:27:33 IST 2012
[INFO] Final Memory: 4M/81M
[INFO] ------------------------------------------------------------------------

Resources