1. #1
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    23
    Vote Rating
    1
    paul_wang is on a distinguished road

      0  

    Default 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
    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.
    
    
    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>
    This is the content of build.xml
    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>
    If I change classpathref="sencha.class.path" to "sencha.class.path2" then it seems to work fine. This is the output.
    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>

  2. #2
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    23
    Vote Rating
    1
    paul_wang is on a distinguished road

      1  

    Default


    Ah, I found the file it wants. It's looking for sencha.cfg. If I copy the file to the current directory then it works.

    Is there a reason this dependency exists? Thanks.

  3. #3
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,339
    Vote Rating
    132
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    Depending on what you are doing with Sencha Cmd, it will need all of the files it installs. Obviously, some of these files are needed by certain functions you might not need so you can pick some things out here and there. This will be maintenance intensive as you upgrade since there is no good way to subset things to support certain functional subsets.

    If I may ask, what is the issue with running the installer on the machine? We would like to know because obviously this is the kind of environment we want to support.
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  4. #4
    Sencha User
    Join Date
    Sep 2012
    Posts
    83
    Vote Rating
    5
    mpost is on a distinguished road

      0  

    Default


    I'm running into similar issues. I don't want to run the installer on every machine because that means the entire build farm would need to be upgraded. It would be far, far easier if I could take Sencha Cmd, check it into my third party asset management system (based on Sonatype Nexus), and then pull it down for each build that needs it -- all without modifying the build system. A detailed guide starting from a .tar file would be extremely helpful here.

    edit: And really what I want to do is eventually use it with maven.

  5. #5
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,339
    Vote Rating
    132
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      2  

    Default


    We are looking at Maven deployment for sure, but just are not there yet. So in the interim...

    The Cmd installer is little more than a self-extracting archive that adds the target folder to the PATH (and provides an uninstaller). Once installed, Cmd makes very few assumptions (see http://docs.sencha.com/ext-js/4-1/#!...mmand_advanced for specifics) so you should be able to tar/zip up the installed version and ship it around as you see fit. Keep in mind that the install is platform-specific and contains native binary executables so you can only unzip/tar and run on the same OS.

    I would recommend looking in the build-impl.xml if you want to see how we "boot up" for builds directly from Ant.

    It boils down to these steps:
    1. Find sencha.jar (this could be as simple as a required property)
    2. Load the antlib
    3. Add sencha.jar to the classpath (if required)
    4. Initialize properties from the Cmd configuration (if needed)

    These are exacted from the build-impl.xml:

    Code:
        <taskdef resource="com/sencha/ant/antlib.xml" classpath="${cmd.dir}/sencha.jar"/>
        <x-extend-classpath>
            <jar path="${cmd.dir}/sencha.jar"/>
        </x-extend-classpath>
        <x-sencha-init prefix=""/>
    The "x-extend-classpath" task adds the sencha.jar (pretty obvious). You'll know if you need this if you get errors about not finding classes from there.

    The "x-sencha-init" task loads the app, workspace and other config properties (found in sencha.cfg files) in to Ant properties. The "prefix" prefixes these properties.

    If you are building a script from scratch you may not need "x-sencha-init".

    For what it is worth, we face similar issues for building Cmd as we rely on many things that are not published in a maven repo. We solved this by creating our own (internal) maven repo where we store those artifacts. This allows our Cmd build to treat them as normal maven dependencies.
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  6. #6
    Sencha User
    Join Date
    Sep 2012
    Posts
    83
    Vote Rating
    5
    mpost is on a distinguished road

      0  

    Default


    Thank you, that was quite informative.

  7. #7
    Sencha Premium Member
    Join Date
    Nov 2011
    Posts
    27
    Vote Rating
    2
    alex.sherwin is on a distinguished road

      0  

    Default


    Am I missing something... I'm having no luck with the ant task, and your comments and the docs make it seem oddly procedural.

    The things I don't understand is where it's looking for configs and what it considers the "working" directory...

    We automate EVERYTHING to do with our builds with ant, and it's imperative to embed ant in the project structure under version control so that automated and continuous integration build systems can build it the same as the developers.

    So, to my excitement, I was happy to see that Sencha Cmd is based on ant... until I tried to use it.

    How do you expect this to work in some kind of structure like this:

    /build.xml
    /modules/module1
    /modules/module2
    /modules/module3
    /web/projects/proj1/desktop
    /web/projects/proj1/mobile
    /web/projects/proj2/desktop
    /web/projects/proj2/mobile
    /web/projects/proj3/desktop
    /web/projects/proj3/mobile

    Where the root build.xml is responsible for building and packaging the whole thing... I don't understand, and the Sencha Cmd doc's I have seen do not make it clear how to invoke commands that operate on those directories properly..

    The closest I have come is like this:

    Code:
      <path id="sencha.classpath">    <fileset file="${sencha.cmd.dir}/sencha.jar"/>
        <fileset file="${sencha.cmd.dir}/lib/ant-contrib-1.0b3.jar"/>
      </path>
    
    
      <taskdef resource="com/sencha/ant/antlib.xml" classpathref="sencha.classpath"/>
    
    
      <target name="compile.web">
      
       <property name="app.dir" location="web/project/register/desktop"/>
       <property name="sdk.dir" location="C:\other\sencha\ext-4.1.3"/>
       <property name="out.dir" location="${dist.basedir}/out"/>
       
        <x-extend-classpath>
         <jar path="${sencha.cmd.dir}/sencha.jar"/>
        </x-extend-classpath>
        
        <x-sencha-init prefix="web/project/register/desktop"/>
    
    
        <x-sencha-command>
        compile
            # Include the app folder and the sdk/src folder
            --classpath=${app.dir},${sdk.dir}/src
    
    
            # Turn off debugging (comment next line to leave debug enabled):
            # --debug=false
    
    
            page
                # The application main page:
                --in=${app.dir}/index.html
    
    
                # The compiled page goes in build folder along with "all-classes.js":
                --out=${out.dir}/index.html
        </x-sencha-command>
    
    
      </target>
    But this nets a circular depdency problem:

    Code:
    Buildfile: c:\other\myproj\build.xml  [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be found.
    
    
    compile.web:
    [x-sencha-command] Nov 19, 2012 9:21:03 PM com.sencha.command.compile.CompileCommands$PageCommand execute
    [x-sencha-command] INFO: Compiling page null
    [x-sencha-command] Nov 19, 2012 9:21:03 PM com.sencha.tools.compiler.CompilerContext loadClassPath
    [x-sencha-command] INFO: Processing classPath entry : c:\other\myproj\sencha-compile-temp-dir
    [x-sencha-command] Nov 19, 2012 9:21:03 PM com.sencha.tools.compiler.CompilerContext loadClassPath
    [x-sencha-command] INFO: Processing classPath entry : c:\other\myproj\web\project\register\desktop
    [x-sencha-command] Nov 19, 2012 9:21:03 PM com.sencha.tools.compiler.CompilerContext loadClassPath
    [x-sencha-command] INFO: Processing classPath entry : C:\other\sencha\ext-4.1.3\src
    [x-sencha-command] Nov 19, 2012 9:21:08 PM com.sencha.tools.compiler.CompilerContext processClassGraph
    [x-sencha-command] INFO: Processing class inheritance graph
    [x-sencha-command] Nov 19, 2012 9:21:08 PM com.sencha.tools.compiler.CompilerContext processReferentialDependencies
    [x-sencha-command] INFO: Processing instantiation refereces to classes and aliases
    [x-sencha-command] Nov 19, 2012 9:21:11 PM com.sencha.tools.compiler.CompilerContext processDependencies
    [x-sencha-command] INFO: Processing source dependencies
    [x-sencha-command] Nov 19, 2012 9:21:11 PM com.sencha.tools.compiler.CompilerContext processFileDependencies
    [x-sencha-command] SEVERE: Circular requires reference :
    [x-sencha-command] C:\other\myproj\web\project\register\desktop\app\app.js ->
    [x-sencha-command] C:\other\sencha\ext-4.1.3\src\app\Application.js ->
    [x-sencha-command] C:\other\sencha\ext-4.1.3\src\app\Controller.js ->
    [x-sencha-command] c:\other\myproj\web\project\register\desktop\ext\builds\ext-all-sandbox-debug-w-comments.js ->
    [x-sencha-command] c:\other\myproj\web\project\register\desktop\ext\ext.js ->
    [x-sencha-command] C:\other\sencha\ext-4.1.3\src\app\Application.js
    [x-sencha-command] Nov 19, 2012 9:21:11 PM com.sencha.command.compile.CompileCommands$PageCommand execute
    [x-sencha-command] SEVERE: Error executing page compilation com.sencha.exceptions.BasicException: com.sencha.exceptions.
    BasicException: com.sencha.exceptions.ExCircularReference: Circular requires reference for file C:\other\sencha\ext-4.1.
    3\src\app\Application.js
    [x-sencha-command] Nov 19, 2012 9:21:11 PM com.sencha.cli.Command dispatch
    [x-sencha-command] SEVERE: InvocationTargetException: null
    
    
    BUILD FAILED
    com.sencha.exceptions.ExBuild: com.sencha.exceptions.BasicException: com.sencha.exceptions.BasicException: com.sencha.ex
    ceptions.BasicException: com.sencha.exceptions.ExCircularReference: Circular requires reference for file C:\other\sencha
    \ext-4.1.3\src\app\Application.js
            at com.sencha.command.compile.CompileCommands$PageCommand.execute(CompileCommands.java:941)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at com.sencha.cli.Command.dispatch(Command.java:78)
            at com.sencha.cli.Commands.dispatch(Commands.java:49)
            at com.sencha.cli.Commands.dispatch(Commands.java:49)
            at com.sencha.cli.AbstractCommand.dispatch(AbstractCommand.java:182)
            at com.sencha.ant.SenchaCommandTask.doExecute(SenchaCommandTask.java:58)
            at com.sencha.ant.BaseAntTask.execute(BaseAntTask.java:22)
            at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            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: com.sencha.exceptions.BasicException: com.sencha.exceptions.BasicException: com.sencha.exceptions.BasicExcept
    ion: com.sencha.exceptions.ExCircularReference: Circular requires reference for file C:\other\sencha\ext-4.1.3\src\app\A
    pplication.js
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:413)
            at com.sencha.tools.compiler.CompilerContext.doProcessDependencies(CompilerContext.java:345)
            at com.sencha.tools.compiler.CompilerContext.processDependencies(CompilerContext.java:335)
            at com.sencha.tools.compiler.CompilerContext.processDependencies(CompilerContext.java:307)
            at com.sencha.command.compile.CompileCommands.getCache(CompileCommands.java:199)
            at com.sencha.command.compile.CompileCommands.getCache(CompileCommands.java:154)
            at com.sencha.command.compile.CompileCommands$PageCommand.execute(CompileCommands.java:926)
            ... 26 more
    Caused by: com.sencha.exceptions.BasicException: com.sencha.exceptions.BasicException: com.sencha.exceptions.ExCircularR
    eference: Circular requires reference for file C:\other\sencha\ext-4.1.3\src\app\Application.js
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:451)
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:488)
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:409)
            ... 32 more
    Caused by: com.sencha.exceptions.BasicException: com.sencha.exceptions.ExCircularReference: Circular requires reference
    for file C:\other\sencha\ext-4.1.3\src\app\Application.js
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:413)
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:391)
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:447)
            ... 34 more
    Caused by: com.sencha.exceptions.ExCircularReference: Circular requires reference for file C:\other\sencha\ext-4.1.3\src
    \app\Application.js
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:380)
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:409)
            ... 36 more
    
    
    Total time: 11 seconds
    
    
    BUILD FAILED
    c:\other\myproj\build.xml:348: com.sencha.exceptions.ExBuild: com.sencha.exceptions.BasicException: com.sencha.exceptio
    ns.BasicException: com.sencha.exceptions.BasicException: com.sencha.exceptions.ExCircularReference: Circular requires re
    ference for file C:\other\sencha\ext-4.1.3\src\app\Application.js
            at com.sencha.command.compile.CompileCommands$PageCommand.execute(CompileCommands.java:941)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at com.sencha.cli.Command.dispatch(Command.java:78)
            at com.sencha.cli.Commands.dispatch(Commands.java:49)
            at com.sencha.cli.Commands.dispatch(Commands.java:49)
            at com.sencha.cli.AbstractCommand.dispatch(AbstractCommand.java:182)
            at com.sencha.ant.SenchaCommandTask.doExecute(SenchaCommandTask.java:58)
            at com.sencha.ant.BaseAntTask.execute(BaseAntTask.java:22)
            at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            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: com.sencha.exceptions.BasicException: com.sencha.exceptions.BasicException: com.sencha.exceptions.BasicExcept
    ion: com.sencha.exceptions.ExCircularReference: Circular requires reference for file C:\other\sencha\ext-4.1.3\src\app\A
    pplication.js
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:413)
            at com.sencha.tools.compiler.CompilerContext.doProcessDependencies(CompilerContext.java:345)
            at com.sencha.tools.compiler.CompilerContext.processDependencies(CompilerContext.java:335)
            at com.sencha.tools.compiler.CompilerContext.processDependencies(CompilerContext.java:307)
            at com.sencha.command.compile.CompileCommands.getCache(CompileCommands.java:199)
            at com.sencha.command.compile.CompileCommands.getCache(CompileCommands.java:154)
            at com.sencha.command.compile.CompileCommands$PageCommand.execute(CompileCommands.java:926)
            ... 26 more
    Caused by: com.sencha.exceptions.BasicException: com.sencha.exceptions.BasicException: com.sencha.exceptions.ExCircularR
    eference: Circular requires reference for file C:\other\sencha\ext-4.1.3\src\app\Application.js
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:451)
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:488)
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:409)
            ... 32 more
    Caused by: com.sencha.exceptions.BasicException: com.sencha.exceptions.ExCircularReference: Circular requires reference
    for file C:\other\sencha\ext-4.1.3\src\app\Application.js
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:413)
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:391)
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:447)
            ... 34 more
    Caused by: com.sencha.exceptions.ExCircularReference: Circular requires reference for file C:\other\sencha\ext-4.1.3\src
    \app\Application.js
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:380)
            at com.sencha.tools.compiler.CompilerContext.processFileDependencies(CompilerContext.java:409)
            ... 36 more
    
    
    Total time: 11 seconds
    Note that I have not been able to resolve the ant contrib warning either... The reference to it in the path is correct.

    It's a unmodified skeleton generated using Sencha Cmd, and it builds fine from the command line using "sencha app build production", etc.

  8. #8
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,339
    Vote Rating
    132
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    Looking over your post I can see there are couple issues in the mix.

    The first is the circular reference. From the log just above the exception callstacks:

    Code:
     SEVERE: Circular requires reference :
     C:\other\myproj\web\project\register\desktop\app\app.js ->
     C:\other\sencha\ext-4.1.3\src\app\Application.js ->
     C:\other\sencha\ext-4.1.3\src\app\Controller.js ->
     c:\other\myproj\web\project\register\desktop\ext\builds\ext-all-sandbox-debug-w-comments.js ->
     c:\other\myproj\web\project\register\desktop\ext\ext.js ->
     C:\other\sencha\ext-4.1.3\src\app\Application.js
    Somehow ext-all-sandbox-debug-w-comments.js is being added to your classpath. Not sure how given the command you are executing. When using the compile command you only want the raw src directory in the classpath not any of the built versions.

    Secondly, I am trying to understand exactly what your master build is doing. If I follow your folder structure's implication, you have several "apps" (one desktop and one mobile in each "project"). How are these structured? Are they set up as "apps" in the Cmd-sense?

    The x-sencha-init prefix will change the properties imported from the sencha.cfg files. It looks like your commands that follow are using the properties without the prefix you've defined.

    If you have some specific questions, it would probably be good to start new threads to help focus on them.
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  9. #9
    Sencha Premium Member
    Join Date
    Nov 2011
    Posts
    8
    Vote Rating
    0
    hkelsey is on a distinguished road

      0  

    Default IllegalAccessError

    IllegalAccessError


    Hi
    I cannot get x-sencha-command to run through ant, I just get an IllegalAccessError. I've checked and I don't have more than one rhino jars on the classpath which some posts suggest could cause the error. It seems strange because it's on the instantiation of CompilerEnvirons which attempts to get the static instance of DefaultErrorReporter which is within the same package as CompilerEnvirons.
    Any help would be greatly appreciated.

    Code:
    com.sencha.exceptions.BasicException: java.lang.IllegalAccessError: tried to access class org/mozilla/javascript/DefaultErrorReporter from class org/mozilla/javascript/CompilerEnvirons
        at com.sencha.cli.Commands$Cmd.create(Commands.java:117)
        at com.sencha.cli.Commands.findCommand(Commands.java:74)
        at com.sencha.cli.Commands.dispatch(Commands.java:43)
        at com.sencha.cli.AbstractCommand.dispatch(AbstractCommand.java:184)
        at com.sencha.ant.SenchaCommandTask.doExecute(SenchaCommandTask.java:58)
        at com.sencha.ant.BaseAntTask.execute(BaseAntTask.java:22)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        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:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        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:809)
        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.IllegalAccessError: tried to access class org/mozilla/javascript/DefaultErrorReporter from class org/mozilla/javascript/CompilerEnvirons
        at org.mozilla.javascript.CompilerEnvirons.<init>(CompilerEnvirons.java:51)
        at com.sencha.tools.compiler.CompilerContext.<init>(CompilerContext.java:45)
        at com.sencha.command.compile.CompileCommands.<init>(CompileCommands.java:64)
        at com.sencha.command.Sencha.createCompile(Sencha.java:95)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sencha.cli.Commands$Cmd.create(Commands.java:99)
        at com.sencha.cli.Commands.findCommand(Commands.java:76)
        at com.sencha.cli.Commands.dispatch(Commands.java:43)
        at com.sencha.cli.AbstractCommand.dispatch(AbstractCommand.java:185)
        at com.sencha.ant.SenchaCommandTask.doExecute(SenchaCommandTask.java:59)
        at com.sencha.ant.BaseAntTask.execute(BaseAntTask.java:22)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        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:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1369)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1253)
        at org.apache.tools.ant.Main.runBuild(Main.java:809)
        at org.apache.tools.ant.Main.startAnt(Main.java:218)
        ... 2 more
    Here is the contents of my build file

    Code:
    <project name="senchabuild" default="compile.web" basedir=".">
        <property name="sencha.dir" value="${basedir}/senchaBuild" />
        <property name="cmd.dir" value="${sencha.dir}"/>
        <path id="sencha.classpath">
            <fileset file="${sencha.dir}/sencha.jar" />
            <fileset file="${sencha.dir}/lib/js.jar" />
        </path>
    
        <taskdef resource="com/sencha/ant/antlib.xml" classpathref="sencha.classpath" />
    
        <target name="compile.web">
    
            <property name="app.dir" location="${basedir}/webapps/sprite/evm" />
            <property name="sdk.dir" location="${basedir}/webapps/sprite/extjs" />
            <property name="out.dir" location="${basedir}/dist/out" />
    
            <x-sencha-init/>
    
    
            <x-sencha-command>
            compile
                # Include the app folder and the sdk/src folder
                --classpath=${app.dir},${sdk.dir}/src
    
    
                # Turn off debugging (comment next line to leave debug enabled):
                --debug=true
    
    
                page
                    # The application main page:
                    --in=${app.dir}/index.html
    
    
                    # The compiled page goes in build folder along with "all-classes.js":
                    --out=${out.dir}/index.html
            </x-sencha-command>
        </target>
    </project>

  10. #10
    Sencha Premium Member
    Join Date
    Nov 2011
    Posts
    8
    Vote Rating
    0
    hkelsey is on a distinguished road

      0  

    Default IllegalAccessError Fix

    IllegalAccessError Fix


    java 6/7 ships with a bundled but incomplete version of rhino which was causing the conflict.
    Adding -Xbootclasspath/a:path/to/rhino-1.7R3.jar to ANT_OPTS will fix the issue. Hope this saves someone some time.