开发者

Ant build script with embedded javascript

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜