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 370341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:00:30+00:00 2026-05-12T14:00:30+00:00

I would like to create an execution order in my plugin which surrounds a

  • 0

I would like to create an execution order in my plugin which surrounds a maven plugin with a before and after execution of another maven plugin. All 3 executions are part of the deploy phase.

Here is an example of what I want to do:

  • phase:deploy
  • url:get: execution-before
  • dependency:unpack
  • url:get: execution-after

Note: url:get is my own custo mojo and just executes an http get using commons httpClient.

I would usually attach the after plugin execution in the next phase but unfortunately deploy is the last phase of the jar lifecycle.

Thank you in advance,

Kostas


Note: The following plugins segment from my pom file creates the following execution order which is not expected:

  • phase:deploy
  • url:get: execution-before
  • url:get: execution-after
  • dependency:unpack

Plugin segment:

        <plugin>
            <groupId>com.blabla.stpadmin</groupId>
            <artifactId>maven-url-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
            <executions>
                <execution>
                    <id>stop-stpadmin-service</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>get</goal>
                    </goals>
                    <configuration>
        ...
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>unpack</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
        ...
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>com.blabla.stpadmin</groupId>
            <artifactId>maven-url-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
            <executions>
                <execution>
                    <id>start-stpadmin-service</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>get</goal>
                    </goals>
                    <configuration>
        ...
                    </configuration>
                </execution>
            </executions>
        </plugin>
  • 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-12T14:00:30+00:00Added an answer on May 12, 2026 at 2:00 pm

    You can bind the execution of each plugin to the same phase and they will be executed in the order you specify. Note they will be executed after the deploy goal has run, so you might want to bind them to the previous phase (install)

    Update: to ensure the execution-before and execution-after goals are executed around the dependency plugin execution, you’ll need to ensure they are defined in separate plugins. Otherwise the two configurations will be merged and executed sequentially.

    If the two executions need to be defined in the same plugin, you can do this by defining a custom lifecycle and invoking that lifecycle before your Mojo is executed via the execute annotation. In this answer I described how to create a custom lifecycle and force it to be invoked before a plugin is run. If you configure the execute-after goal to invoke the dependency-plugin you’ll get the execution order you want (you could even invoke the execute-before goal in that lifecycle as well).

    The example below will execute the three plugins in order during the deploy phase:

      <plugin>
        <groupId>custom.url.plugin</groupId>
        <artifactId>maven-url-plugin</artifactId>
        <version>1.0</version>
        <executions>
          <execution>
            <phase>deploy</phase>
            <goals>
              <goal>execution-before</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.1</version>
        <executions>
          <execution>
            <phase>deploy</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>custom.url.plugin</groupId>
        <!--specify final execution in a different plugin to 
               avoid the configurations being merged-->
        <artifactId>maven-url-2-plugin</artifactId>
        <version>1.0</version>
        <executions>
          <execution>
            <phase>deploy</phase>
            <goals>
              <goal>execution-after</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 410k
  • Answers 410k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The problem is that when you're taking the value of… May 15, 2026 at 7:36 am
  • Editorial Team
    Editorial Team added an answer There are a couple ORM-like libraries in the works nowadays.… May 15, 2026 at 7:36 am
  • Editorial Team
    Editorial Team added an answer Use lookarounds: str.split("(?<=\\d)(?=\\D)") String[] parts = "123XYZ".split("(?<=\\d)(?=\\D)"); System.out.println(parts[0] + "-"… May 15, 2026 at 7:36 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.