简体   繁体   中英

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.

But I try to make username and password are a variables in a file then read it in xml like this :

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

where can I put these variables to make ivysettings.xml read it ?

UPDATE
To read variables from file let's say that file is named file123.properties and has the following content

myUser=actualUsername
myPassword=actualPassword

to use this file and it's variables in 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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