Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4019704
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:08:15+00:00 2026-05-20T10:08:15+00:00

I was going through a book that explain how to override ‘default’ lifecycle of

  • 0

I was going through a book that explain how to override ‘default’ lifecycle of Maven.

It says: To define a new lifecycle for a packaging type, you’ll need to configure a LifecycleMapping component in Plexus. In your plugin project, create a META-INF/plexus/components.xml under src/main/resources. In components.xml add the content as shown below, and you’re done. With below configuration, I’m able to customize the default lifecycle for ‘jar’ packaging type. Now If I exeute
$ mvn package


It straigh away executes ‘package’ phase skipping all other phases of default lifecycle and executes ‘echo’ goal of ‘maven-zip-plugin’.

<component-set>
    <components>
        <component>
            <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
            <role-hint>zip</role-hint>
            <implementation>
                org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
            </implementation>
            <configuration>
                <phases>
                    <package>org.sonatype.mavenbook.plugins:maven-zip-plugin:echo
                    </package>
                </phases>
            </configuration>
        </component>
    </components>
</component-set>

My question is: How can I customize ‘clean’ lifecycle. For example, assume when some one types
$ mvn clean

Instead of running clean:clean that will execute ‘clean’ goal of ‘maven-clean-plugin’ plugin, I wanted to execute ‘customClean’ goal of ‘customPlugin’.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:08:16+00:00Added an answer on May 20, 2026 at 10:08 am

    For what you describe, it is simpler to just prevent the maven-clean-plugin from running during the clean phase, and attach customPlugin to the clean phase instead. This is simpler than short-circuiting the whole lifecycle, and keeps all your maven config in your pom.

    1 prevent the maven-clean-plugin

    <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.4.1</version>
        <configuration>
            <skip>true</skip>
        </configuration>
    </plugin>
    

    2 attach your own plugin to the clean phase

    <plugin>
        <artifactId>maven-customPlugin-plugin</artifactId>
        <version>customPlugin-version</version>
        <executions>
            <execution>
                <id>customised-clean</id>
                <goals>
                    <goal>customClean</goal>
                </goals>
                <phase>clean</phase>
            </execution>
        </executions>
    </plugin>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was going through http://web2py.com/book/default/chapter/02 and found this: >>> print 'number is ' +
I was going through the AWDR book on web development with ruby on rails
After going through the Appendix A, C# Coding Style Conventions of the great book
I'm going through a book of general c# development, and I've come to the
Please help me with this code - I am basically going through a book
I was going through the wonderful book Programming in Scala when I came across
I'm going through the Django book and I'm currently on chapter 10 . I'm
I am new to Java and have background of C.I am going through Khalid
I am reading the book Patterns of enterprise application architecture . While going through
I'm going through the problems in the Haskell O'Reilly book. The problem I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.