簡體   English   中英

具有特殊字符的Ant屬性

[英]Ant properties with special characters

我正在嘗試將密碼和用戶名作為參數傳遞給我的ant文件connectionTester.xml。正在使用-v和-d選項運行ant。 我認為該物業發生的變化使我感到非常討厭,無法找到解決方案。 密碼包含$字符,當后面跟隨形成Linux命令的字符時,該字符將被替換,如下面的詳細輸出所示。

如何處理這種情況。 密碼被刪除或替換為其他密碼,最終構建失敗。

[u@VM:h W]$ /opt/app/apache-ant-1.9.2/bin/ant -file connectionTester.xml -DdeployServer_user=xxxxxxx -DdeployServer.password=apr20$1 -v -d
Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Buildfile: /home/xxxxxx/connectionTester.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.7 in: /usr/java/jdk1.7.0_25/jre
Detected OS: Linux
Adding reference: ant.ComponentHelper
Setting ro project property: deployServer_user -> xx49783
Setting ro project property: deployServer.password -> apr20-file
Setting ro project property: ant.file -> /home/xx49663/connectionTester.xml
Setting ro project property: ant.file.type -> file

像在命令行中一樣,嘗試在ant調用之前在命令行中設置密碼並轉義$的含義(考慮到它在命令行中作為純文本傳遞)

$myPass=apr20\$1

然后用

-DdeployServer.password=$myPass

嘗試像

-DdeployServer.password='apr20\$1'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM