ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Petar Tahchiev <paranoia...@gmail.com>
Subject Re: How to get user project properties from java
Date Fri, 23 Dec 2005 07:50:04 GMT
On 22/12/05, Antonio, Jean Claude (Spring IT) <
jeanclaude.antonio-eds@eds.com> wrote:
>
> Hello,
>
> I'm writing a java application that call ant.
> It works fine.
> But I want to get project properties defined in the build.xml file.
>
> With project.getUserProperty("serverName");
> or   project.getProperty("serverName");
> I get a returned null value.
>
> ----------------------------------------------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <project name="InitialProject" basedir="." default="clear">
>             <property name="serverName"     value="localhost"/>
>
>
> Project project= new Project();
> ProjectHelper helper = new ProjectHelperImpl();
> project.init();
> helper.parse(antProject, new File("build.xml"));
>
> project.getUserProperty("serverName");
>
> ----------------------------------------------------------------
> Cheers
>
>
I think you should use the project.getProperty("Blah") method here instead
of project.getUserProperty("Blah"). Ant API says:
getUserProperty - Returns the value of a user property, if it is set.

getProperty - Returns the value of a property, if it is set.


--
Regards, Petar!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message