Threaded View
-
4 Oct 2012 4:04 PM #1
How to use sencha.jar with Ant
How to use sencha.jar with Ant
Hi,
I'm trying to run sencha commands from my Ant file using sencha.jar without much success. If I point my classpath to where I installed Sencha then it seems to work but if I just copy sencha.jar and the lib directory it gave me an error.
I need to know what it is looking for so I can run it on a machine that does not have Sencha Cmd installed.
I copied from Sencha directory sencha.jar and lib\ to the current directory and this is the output from build.xml
This is the content of build.xmlCode:c:\work_tmp>ant dist.sencha Buildfile: c:\work_tmp\build.xml dist.sencha: [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be found. BUILD FAILED java.lang.NullPointerException at com.sencha.command.ConfigOverrideLoader.loadOverrides(ConfigOverrideLoader.java:139) at com.sencha.command.ConfigOverrideLoader.getOverride(ConfigOverrideLoader.java:38) at com.sencha.command.SenchaConfigManager.checkForOverride(SenchaConfigManager.java:173) at com.sencha.command.SenchaConfigManager.getConfig(SenchaConfigManager.java:166) at com.sencha.command.SenchaConfigManager.getConfig(SenchaConfigManager.java:57) at com.sencha.command.Sencha.<init>(Sencha.java:40) at com.sencha.ant.SenchaCommandTask.doExecute(SenchaCommandTask.java:34) at com.sencha.ant.BaseAntTask.execute(BaseAntTask.java:21) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:392) at org.apache.tools.ant.Target.performTasks(Target.java:413) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.Main.runBuild(Main.java:811) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Total time: 0 seconds BUILD FAILED c:\work_tmp\build.xml:17: com.sencha.exceptions.BasicException at com.sencha.exceptions.BasicException.wrap(BasicException.java:43) at com.sencha.ant.BaseAntTask.execute(BaseAntTask.java:25) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:392) at org.apache.tools.ant.Target.performTasks(Target.java:413) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.Main.runBuild(Main.java:811) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Caused by: java.lang.NullPointerException at com.sencha.command.ConfigOverrideLoader.loadOverrides(ConfigOverrideLoader.java:139) at com.sencha.command.ConfigOverrideLoader.getOverride(ConfigOverrideLoader.java:38) at com.sencha.command.SenchaConfigManager.checkForOverride(SenchaConfigManager.java:173) at com.sencha.command.SenchaConfigManager.getConfig(SenchaConfigManager.java:166) at com.sencha.command.SenchaConfigManager.getConfig(SenchaConfigManager.java:57) at com.sencha.command.Sencha.<init>(Sencha.java:40) at com.sencha.ant.SenchaCommandTask.doExecute(SenchaCommandTask.java:34) at com.sencha.ant.BaseAntTask.execute(BaseAntTask.java:21) ... 17 more Total time: 0 seconds c:\work_tmp>
If I change classpathref="sencha.class.path" to "sencha.class.path2" then it seems to work fine. This is the output.Code:<project name="work_tmp" default="dist.sencha" basedir="."> <target name="dist.sencha"> <path id="sencha.class.path2"> <fileset dir="c:\Program Files (x86)\SenchaCmd-3.0.0.181\Sencha\Cmd\3.0.0.181\lib" includes="*.jar"/> <fileset dir="c:\Program Files (x86)\SenchaCmd-3.0.0.181\Sencha\Cmd\3.0.0.181\" includes="*.jar"/> </path> <path id="sencha.class.path"> <fileset dir="lib" includes="*.jar"/> <fileset dir="." includes="sencha.jar"/> </path> <taskdef resource="com/sencha/ant/antlib.xml" classpathref="sencha.class.path"/> <x-sencha-command> compile </x-sencha-command> </target> </project>
Code:c:\work_tmp>ant dist.sencha Buildfile: c:\work_tmp\build.xml dist.sencha: [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be found. [x-sencha-command] sencha compile [x-sencha-command] [x-sencha-command] [x-sencha-command] This command category provides JavaScript compilation commands. The [x-sencha-command] compile [x-sencha-command] [x-sencha-command] category maintains compilation state across its sub-commands so using [x-sencha-command] and [x-sencha-command] to [x-sencha-command] connect sub-commands can provide significant time savings compared to making [x-sencha-command] repeated calls. [x-sencha-command] [x-sencha-command] [x-sencha-command] OPTIONS [x-sencha-command] [x-sencha-command] * [x-sencha-command] --classpath [x-sencha-command] , [x-sencha-command] -cl [x-sencha-command] - adds fodler(s) to the class path [x-sencha-command] * [x-sencha-command] --debug [x-sencha-command] , [x-sencha-command] -deb [x-sencha-command] - enables the debug option for the js directive parser [x-sencha-command] * [x-sencha-command] --deferred-overrides [x-sencha-command] , [x-sencha-command] -def [x-sencha-command] - enable / disable deferred override processing (use with optimize) [x-sencha-command] * [x-sencha-command] --ignore [x-sencha-command] , [x-sencha-command] -ig [x-sencha-command] - excludes files with names containing the given substrings from the class path (comma separated) [x-sencha-command] * [x-sencha-command] --options [x-sencha-command] , [x-sencha-command] -o [x-sencha-command] - sets options for the js directive parser (name:value,...) [x-sencha-command] [x-sencha-command] COMMANDS [x-sencha-command] [x-sencha-command] * [x-sencha-command] concatenate [x-sencha-command] - produce a concatenated build [x-sencha-command] * [x-sencha-command] exclude [x-sencha-command] - exclude files from the compilation set [x-sencha-command] * [x-sencha-command] include [x-sencha-command] - include files into the compilation set [x-sencha-command] * [x-sencha-command] intersect [x-sencha-command] - create a new save set by intersecting existing sets [x-sencha-command] * [x-sencha-command] metadata [x-sencha-command] - produce class metadata [x-sencha-command] * [x-sencha-command] page [x-sencha-command] - compiles a page [x-sencha-command] * [x-sencha-command] restore [x-sencha-command] - alias for 'exclude +all and include -set=<set-name>' [x-sencha-command] * [x-sencha-command] save [x-sencha-command] - remembers the currently enabled file state by a name [x-sencha-command] * [x-sencha-command] show-ignored [x-sencha-command] - displays ignored files from the current classpath [x-sencha-command] * [x-sencha-command] union [x-sencha-command] - alias for 'exclude +all and include ...' [x-sencha-command] BUILD SUCCESSFUL Total time: 1 second c:\work_tmp>
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote