What does "mvn -P" do?

Gadam picture Gadam · Dec 8, 2014 · Viewed 15.4k times · Source

I have been told to use mvn clean install -P base at work for a particular task. I am trying to find what it exactly means.

According to https://maven.apache.org/archives/maven-1.x/reference/command-line.html , -P lists all available plugins; and -p is used to specify a project file (assuming pom).

But when I typed mvn -P in my command line, I got an error saying:

Unable to parse command line options: Missing argument for option: P

usage: mvn [options] [<goal(s)>] [<phase(s)>]

What do the -P and -p stand for, and what are they used for exactly?

Answer

Makoto picture Makoto · Dec 8, 2014

A reference tells us that -P specifies which profile Maven is to run under. Projects can define multiple profiles which may pull in different dependencies, so this is required if you have a project that can do that.

The -p flag isn't one I've run into in practice, nor does it really seem to exist in modern versions of Maven.