开发者

ant is not initialized during runtime

开发者 https://www.devze.com 2023-03-25 11:19 出处:网络
Here is my java Coding to call ant file during runtime: File buildFile = new File(dir + File.separator + \"build.xml\");

Here is my java Coding to call ant file during runtime:

File buildFile = new File(dir + File.separator + "build.xml");
Project p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
DefaultLogger consoleLogger = new DefaultLogger();
consoleLogger.setErrorPrintStream(System.err);
consoleLogger.setOutputPrintStream(System.out);
consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
p.addBuildListener(consoleLogger);
p.fireBuildStarted();
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, buildFile);
p.executeTarget("deploy");

Using the above code i want to a create build.Here,My problem is while i executing this program in Eclipse IDE i got output with no error and new Build is created ,but same thing i run, after converting my program into jar,all lines executed well upto this below line

p.init();

I dont Know why it happens..Please Help me..Th开发者_运维技巧anks in advance...


Check whether all ant jar file is included or not....may be u missed some jar file ...for me running correctly

0

精彩评论

暂无评论...
验证码 换一张
取 消