0

I have been using maven for sometime, and I understand some of the basics of maven. I want to know how actually it works, and in this quest, I have this question.

When we execute a command like this:

mvn clean install

From where does it get the instructions; comparing it with ant, in ant we have build.xml which instructs how to do the work.

Is there any "built-in" file which mvn uses to "see" what actions it has to do?

Any response to clarify this greatly appreciated.

CuriousMind
  • 8,301
  • 22
  • 65
  • 134
  • How have you used Maven so far without the command `mvn clean install`? – nobeh Jan 15 '16 at 07:27
  • Thanks for your comment; I am not saying that I used maven without mvn clean install. Trying to understand how it works internally. – CuriousMind Jan 15 '16 at 07:30
  • 1
    May be the following link will help http://stackoverflow.com/questions/6018701/how-is-mvn-clean-install-different-from-mvn-install cheers – asb Jan 15 '16 at 07:35

1 Answers1

3

Maven is organized in Build Lifecycles and phases. There are only 3 Lifecycles, namely

  • clean
  • build
  • site

With build being the most relevant one , separated into several phases. When you run mvn install you run the install phase of the build lifecycle.

Plugins and their goals are bound to phases. Maven delivers some default plugins (like jar or war) that are bound to the according phases.

But you can also explicitly bind (your own or other non standard) plugins to phases with the <execution>tag. With this tag you bind one or more goals of a plugin to a phase of the build lifecycle (see link above).

Hendrik Jander
  • 5,515
  • 3
  • 23
  • 31