假设我的maven项目位于/some/location/project并且我当前的位置是/another/location/如何在不更改项目位置的情况下运行maven构建cd /some/location/project?
dun*_*nni 394
您可以使用该参数-f并指定pom文件的路径,例如mvn -f /path/to/pom.xml
这运行maven"好像"它在/path/to工作目录中.
Kyl*_*ton 14
我不认为maven支持这个.如果您使用的是Unix,并且不想离开当前目录,则可以使用小型shell脚本,shell函数或仅使用子shell:
user@host ~/project$ (cd ~/some/location; mvn install)
[ ... mvn build ... ]
user@host ~/project$
作为bash函数(可以添加到〜/ .bashrc中):
function mvn-there() {
  DIR="$1"
  shift
  (cd $DIR; mvn "$@")     
} 
user@host ~/project$ mvn-there ~/some/location install)
[ ... mvn build ... ]
user@host ~/project$
我意识到这并没有回答具体问题,但可能会为您提供您所追求的内容.我不熟悉Windows shell,但你也应该能够在那里找到类似的解决方案.
问候
| 归档时间: | 
 | 
| 查看次数: | 110171 次 | 
| 最近记录: |