开发者

Ant build script with embedded javascript

开发者 https://www.devze.com 2023-03-16 20:19 出处:网络
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.

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

精彩评论

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