Hello all,
I'm trying to read an ant script through java and find where all its .java files and libraries are located. I've gone through the Apache ant API but couldn't find an appropriate method. So far all I could come up was the below code, it gives the properties and all but the problem is if the .java classes are not in a src folder I won't be able to sort the results. I would appreciate any help. Thanx in advance.
public class PropertyReader {
public static void main(String[] args) throws Exception {
File buildFile = new File("build1.xml");
final Project project = new Project();
project.init();
ProjectHelper.configureProject(project, buildFile);
Hashtable<String, Integer> prop = project.getProperties();
for (Entry<String, Integer> entry : prop.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
System.out.println(key+" --- "+value);
}
}
}