Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "mvn -P" do?

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?

like image 505
Gadam Avatar asked Dec 08 '14 21:12

Gadam


People also ask

What is mvn clean install U?

-U forces maven to check any external dependencies (third party dependencies) that might need to be updated based on your POM files. clean install are both basic maven lifecycle phases (https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html).

What does Maven clean package do?

mvn clean: Cleans the project and removes all files generated by the previous build. mvn compile: Compiles source code of the project. mvn test-compile: Compiles the test source code.

What is mvn command?

mvn compile: This command is used to compile the project's source code. mvn clean: Here, the project is cleaned to remove all previous-build files generated. mvn test: With this command, one can run project testing steps. mvn test-compile: This command is used to compile the code from the test source.

What is Maven build command?

To build a Maven project via the command line, you use the mvn command from the command line. The command must be executed in the directory which contains the relevant pom file. You pass the build life cycle, phase or goal as parameter to this command.


1 Answers

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.

like image 106
Makoto Avatar answered Sep 30 '22 13:09

Makoto