Currently I am trying to build an Android app using ant on a Glassfish server, this is to be part of a service to generate a customised Android Application.
My build.xml works perfectly fine when run locally outside of glassfish but when running it within a glassfish instance I get a problem where ant can't find a class (that is part of the Java Runtime):
C:\androidsdk\adt-bundle-windows-x86_64\sdk\tools\ant\build.xml:112: taskdef A class needed by class com.android.ant.GetTypeTask cannot be found: javax/xml/xpath/XPathExpressionException
I made a stackoverflow question about it a few weeks ago: http://stackoverflow.com/questions/14627660/ant-cant-find-xpathexpressio...
I thought it may of been due to the android SDK libraries being external to the server so I tried placing them in the lib folder of the domain to no avail.
The main piece of code that I am using is:
File dir = new File("C:\\AndroidAppSourceDirectory");
File buildFile = new File(dir, "build.xml");
Project project = new Project();
project.setUserProperty("ant.file", buildFile.getAbsolutePath());
project.setBaseDir(dir);
DefaultLogger consoleLogger = new DefaultLogger();
consoleLogger.setErrorPrintStream(System.err);
consoleLogger.setOutputPrintStream(System.out);
consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
project.addBuildListener(consoleLogger);
project.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
project.addReference("ant.projectHelper", helper);
helper.parse(project, buildFile);
project.executeTarget(project.getDefaultTarget());
Any help would be appreciated, thanks,
Lyndon,