在运行配置中如何传递文字变量引用($ {foo})作为程序参数 [英] How to pass a literal variable reference (${foo}) as program argument in a run configuration
问题描述
在Eclipse中,当您在运行对话框中指定参数时,Eclipse将 $ {foo}
解释为使用Eclipse变量 foo 的请求。我想传递一个包含 $ {foo}
的应用程序的字符串,但是Eclipse将其视为一个未定义的变量,并给我一个错误。
In Eclipse, when you specify arguments in the run dialog, Eclipse interprets ${foo}
as a request to use the Eclipse variable foo. I would like to pass a string to my application that contains ${foo}
but Eclipse treats this as an undefined variable and gives me an error.
-Dfoo "bar" --pattern "regex magic ${foo}"
Eclipse不接受单引号(')作为引号,而是成为输入的一部分。有人知道我在这个对话框中如何逃避 $ {foo}
,所以它被解释为文本而不是变量引用?
Eclipse does not accept the single quote (') as a quoting character, instead it becomes part of the input. Does anyone know how I can escape ${foo}
in this dialog so it is interpreted as text and not a variable reference?
推荐答案
您必须在Eclipse中定义一个变量:
name = dollar,value = $
You have to define a variable in Eclipse: name = dollar, value = $
这可以在运行配置对话框中,当您键入参数时,单击变量...,然后单击编辑变量...,然后添加该变量。)
(This can be done in the "run configuration" dialog, when you type your arguments, click "Variables...", and then click "Edit variables...", and add that variable).
然后,在参数文本框中键入
$ {dollar}{foo}
Then, in the arguments text-box, type ${dollar}"{foo}"
这篇关于在运行配置中如何传递文字变量引用($ {foo})作为程序参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!