1

AFAIK, you can create a custom build lifecycle in maven.

Also, AFAIK, you cannot tell maven to execute a lifecycle. You can either:

  1. Tell maven to execute a phase: In this case, maven finds in which lifecycle this phase is, and then executes all phases in that lifecycle, up to the phase specified.

  2. Tell maven to execute a goal, by specifying it as mvn plugin_name:goal_name

So, assume that I have created a custom lifecycle. And assume that this custom lifecycle has a phase named install.

When I write mvn install, will maven execute the default lifecycle (which has a phase named install) or my custom lifecycle (which also has a phase named install)?

How will maven determine which lifecycle to follow?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Utku
  • 2,025
  • 22
  • 42
  • That's an interesting question. Note that it is also closely related to the packaging: a custom lifecycle would typically override the default lifecycle by declaring a new specific packaging. Thus `mvn install` would invoke the `install` phase of the lifecyle configured for that packaging. This does still leave the more general question (about `clean` and `site` lifecycles, that aren't tied to a packaging). Also related: http://stackoverflow.com/a/11557638/1743880 – Tunaki May 24 '16 at 19:10

1 Answers1

0

This is not supported (yet), though recently Stephen started a thread about it: http://maven.markmail.org/thread/z57dzgunecgfcrf7

Robert Scholte
  • 11,889
  • 2
  • 35
  • 44
  • Interesting (I feared it wasn't supported). Would it be possible to summarize what is being said in the emails in your answer? (in case the link dies). – Tunaki May 24 '16 at 20:34
  • We've identified that the current default (build-)lifecycle is often abused as a custom lifecycle and that it is hard quite hard to specify your own custom lifecycle. This should somehow be simplified and in case it is a widely used lifecycle, it should be added to Maven to become a new standard and to prevent a wide range of different lifecycles (compared to the targets of Ant) – Robert Scholte May 25 '16 at 20:03