How to extract properties from Ant file (build.xml) into Java code -


once build.xml file executed, want check properties in build.xml handle errors in java code.

for infos, ant file (build.xml) executed way (not code present):

ilaunchconfigurationworkingcopy workingcopy = type.newinstance(null,                 itasklauncherconstants.launcher_name);  /* configure ilaunchconfiguration (not setattribute calls presents) :*/ workingcopy.setattribute(iexternaltoolconstants.attr_location, "build.xml");   /* launch task, monitor iprogressmonitor */ ilaunch lc = workingcopy.launch(ilaunchmanager.run_mode, monitor); 

and in build.xml file have properties :

<!-- in ant file --> <property name="fail.message" value="true" /> 

is possible check content of property in java code ? :

/* in java code */ lc.getproperty("fail.message"); 

of course, mean class "record" build.xml properties.

same question has been asked 6 months ago, answer not working (i tried):

how set property in java code using build.xml

thanks suggestion.

a simple approach using echoproperties task in ant buildscript, means writing or desired (via echoproperties attribute prefix) properties file , load file in java afterwards.
ant manual echoproperties, attribute destfile :

if specified, value indicates name of file send output of statement to. generated output file compatible loading java application property file. if not specified, output go apache ant log.

<echoproperties prefix="fail" destfile="what/ever/foo.properties"/> 

Comments