如何告诉 Maven 从特定文件中获取 MAVEN_OPTS? [英] How to tell maven to get MAVEN_OPTS from specific file?

查看:64
本文介绍了如何告诉 Maven 从特定文件中获取 MAVEN_OPTS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mvn 命令,其中包括以下选项:

mvn command, among others, have following options:

  • -f,--file 强制使用备用 POM 文件.(这是用于指向文件而不是默认的 pom.xml 文件.)
  • -gs,--global-settings 全局设置文件的备用路径.(这个是用来指向settings.xml文件的,默认在.m2目录下.)
  • -f,--file <arg> Force the use of an alternate POM file. (This is for pointing file instead of default pom.xml file.)
  • -gs,--global-settings <arg> Alternate path for the global settings file. (This one is for pointing the settings.xml file, which is by default in .m2 directory.)

仍然有一个配置文件被这些选项发现 - .mavenrc

Still there is yet one config file uncovered by these options - .mavenrc

所以,我的问题是 - 有没有办法告诉 maven 应该从哪个文件中获取 MAVEN_OPTS?

So, my question is - Is there a way to tell maven from which file it should get MAVEN_OPTS?

推荐答案

MAVEN_OPTS 是来自操作系统的环境变量.在启动 maven 之前,您可以随意设置它.

MAVEN_OPTS is a environment variable from the OS. You can set it anyway you want before launching maven.

在 bash (linux) 中:

In bash (linux):

export MAVEN_OPTS=...

在窗户上:

set MAVEN_OPTS=...

我认为您甚至可以编辑mvn.bat"shell 脚本的mvn"来获取不同的变量.

I think you could even edit the 'mvn' of 'mvn.bat' shell script to get different variables.

这篇关于如何告诉 Maven 从特定文件中获取 MAVEN_OPTS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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