0

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 following 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?

1
  • That worked....why did you remove your answer? Commented Jun 30, 2011 at 0:22

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.