DEV Community

taijidude
taijidude

Posted on

You don't have to cd into the folder to build the maven project

Hello again dear reader! :-)

About two weeks ago i realized a thing about maven, which will come in handy when working on my build scripts again.

The title already says it pretty much. You don't have to cd into the project folder. You can just use the -f parameter and give maven the path to the directory to where the pom can be found.

Example:

mvn -f D:\temp\mvnfromafar\ clean install
Enter fullscreen mode Exit fullscreen mode

This is also possible but not necessary:

mvn -f D:\temp\mvnfromafar\pom.xml clean install
Enter fullscreen mode Exit fullscreen mode

Discussion (0)