Environment Variable with Maven

前端 未结 9 2166
攒了一身酷
攒了一身酷 2020-11-28 03:24

I\'ve ported a project from Eclipse to Maven and I need to set an environment variable to make my project work.

In Eclipse, I go to \"Run -> Run configurations\" and

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 03:51

    You can pass some of the arguments through the _JAVA_OPTIONS variable.

    For example, define a variable for maven proxy flags like this:

    _JAVA_OPTIONS="-Dhttp.proxyHost=$http_proxy_host -Dhttp.proxyPort=$http_proxy_port -Dhttps.proxyHost=$https_proxy_host -Dhttps.proxyPort=$http_proxy_port"
    

    And then use mvn clean install (it will automatically pick up _JAVA_OPTIONS).

提交回复
热议问题