简体   繁体   English

IntelliJ:如何在settings.xml中设置变量?

[英]IntelliJ : How to setup variables in settings.xml?

I use ivyIDEA plugin in IntelliJ IDE and every thing is ok when I insert my username and password manually with their values in ivysettings.xml file. 我在IntelliJ IDE中使用ivyIDEA插件,当我在ivysettings.xml文件中手动输入用户名和密码及其值时,一切正常。

But I try to make username and password are a variables in a file then read it in xml like this : 但是我尝试使用户名密码成为文件中的变量,然后像这样在xml读取它:

<credentials host="myhost" realm="Artifactory Realm"
             username="${file.USER}" passwd="${file.PASS}" />

where can I put these variables to make ivysettings.xml read it ? 我在哪里可以放置这些变量以使ivysettings.xml读取它?

UPDATE UPDATE
To read variables from file let's say that file is named file123.properties and has the following content 要从文件读取变量,假设该文件名为file123.properties并且具有以下内容

myUser=actualUsername
myPassword=actualPassword

to use this file and it's variables in ivysettings.xml : 使用此文件及其在ivysettings.xml的变量:

<properties file="file123.properties"/>
<credentials host="myhost" realm="Artifactory Realm" username="${myUser}" passwd="${myPassword}" />

Of course this implies that both files are on the same path. 当然,这意味着两个文件都在同一路径上。


To use directly in ivysettings.xml Simply define them as properties 直接在ivysettings.xml中使用只需将它们定义为属性

 <property name="myUser" value="actualUsername" /> <property name="myPassword" value="actualPassword" /> <credentials host="myhost" realm="Artifactory Realm" username="${myUser}" passwd="${myPassword}" /> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM