I have the following ant task that has embedded javascript. I'm trying to read the value of a property in my build.properties file but the followi开发者_如何学Cng doesn't seem to work.
<target name="analyze">
<script language="javascript">
<![CDATA[
importPackage(java.lang);
var path = "${FOOBAR_HOME}";
System.out.println(path);
]]>
</script>
</target>
Anyone know how to do this?
Assuming that your build.properties file is loaded before the script task using a loadproperties
task or equivalent, then you could use something like:
var path = project.getProperty("FOOBAR_HOME");
or even just
var path = FOOBAR_HOME;
in the javascript. This is from the examples in the script
task docs.
精彩评论