Search code examples
javamavenmaven-pluginmaven-3mojo

Maven : what does "build life cycle mapping" mean


I have been trying to understand the concepts of Maven and I find it difficult to understand the terminology used.

I came across this term "build life cycle mapping". Could anybody give me a clear view on what this term means? I know what build life cycle is, but what does it mean when we use "mapping" with it?

Thanks in advance for any help

Update: this is where i found this term- Project build lifecycle mapping


Solution

  • OK, so as you know, Maven provides kind of build lifecycle, that is sequence of phases, that starts with such basic stuff as validating POMs, generating sources (if there is a need) or compiling classes, and ends with installing stuff into local repository and deploying artifacts on remote repos. What is important, this is a sequence, so order matters here. If you invoke some phase (let's say install) then all phases from the beginning to the install are executed, one after another.

    Now, these lifecycle's phases are some general ideas about what steps every software project needs to perform to be built, as we usually consider this. And as you know, software artifacts can have many different natures and so need quite specific stuff to be done in every phase. That's what lifecycle mapping is. It is binding between lifecycle's phases and concrete plugins' goals that is specific for artifact's nature (which means packaging in Maven world).

    So, for example, this mapping for jar packaging says that we need to call maven-compiler-plugin:compile in compile phase, but ear packaging says that we need to call nothing in its compile phase. Look here for more examples.