IAmYourFaja
IAmYourFaja

Reputation: 56874

Ant won't import properties

My build begins by defining 2 properties files, importing another build XML, and then commencing with all my other targets & tasks:

build.main.xml:

<project name="${proj.name}" default="assemble" basedir=".">
    <!-- BASIC CONFIGURATIONS -->
    <!-- Define build properties. -->
    <property file="build.main.properties"/>
    <property file="build.app.properties"/>

    <!-- Imports. -->
    <import file="${alt.build.file}"/>

    <!-- Rest of buildscript omitted for brevity... -->
</project>

build.app.properties:

proj.name=test-proj
alt.build.file=build.app.xml

It seems that build.main.xml cannot seem to see/find any properties defined inside build.app.properties; specifically:

What's going on here? Do ant builds only get to import one properties file or something?!? Where could I start troubleshooting?

Edit: using Eclipse editor my buildscript does not have any red/highlighted syntax errors that might be causing the ant plugin to work incorrectly, etc.

Edit: I am noticing issues with properties defined inside the build.main.properties to. If I try to echo them they don't get noticed by Ant either...

Upvotes: 4

Views: 2076

Answers (1)

jabal
jabal

Reputation: 12337

The Ant project name cannot be itself a property for the reason Jochen mentioned in his comment.

Try running your script with the -v option to see more logging. I have used a technique very similar to your <import file="${alt.build.file}"/> to branch my script based on the db platform, so there should be no problem with it.

I wondered if your property files are in the same directory then your build script is.

Upvotes: 2

Related Questions