如何从另一个目录运行 Maven(没有 cd 到项目目录)? [英] How to run Maven from another directory (without cd to project dir)?

查看:17
本文介绍了如何从另一个目录运行 Maven(没有 cd 到项目目录)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我的 maven 项目位于 /some/location/project 并且我当前的位置是 /another/location/ 如何在不更改项目的情况下运行 maven buildlocation cd/some/location/project?

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(或 --file)并指定路径pom 文件,例如mvn -f/path/to/pom.xml

You can use the parameter -f (or --file) and specify the path to your pom file, e.g. mvn -f /path/to/pom.xml

这会运行 maven 好像"它位于工作目录的 /path/to 中.

This runs maven "as if" it were in /path/to for the working directory.

这篇关于如何从另一个目录运行 Maven(没有 cd 到项目目录)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆