如何从另一个目录(没有cd到项目目录)运行Maven? [英] How to run Maven from another directory (without cd to project dir)?
本文介绍了如何从另一个目录(没有cd到项目目录)运行Maven?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我的maven项目位于/some/location/project
,而我的当前位置是/another/location/
,如何在不更改项目位置cd /some/location/project
的情况下运行maven build?
Supposing my maven project is located in /some/location/project
and my current location is /another/location/
how can I run maven build without changing to project location cd /some/location/project
?
推荐答案
您可以使用参数-f
并指定pom文件的路径,例如mvn -f /path/to/pom.xml
You can use the parameter -f
and specify the path to your pom file, e.g. mvn -f /path/to/pom.xml
这会像在/path/to
中的工作目录中一样运行" maven.
This runs maven "as if" it were in /path/to
for the working directory.
这篇关于如何从另一个目录(没有cd到项目目录)运行Maven?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文