5 Mar 2011 11:39 PM #11
The library approach actually works rather nicely in IDEA 10 (Ultimate), thx for the hint! I think that this might not have been supported in IDEA 9, but I'm not sure.
I put the Ext files into a libs folder inside my project, e.g. [project-dir]/client/libs/ext-3.3.1 and pointed the library source to ../ext-3.3.1/src. I then excluded the complete ext-3.3.1 folder from the project (under Project Settings / Modules / Paths). This way IDEA's JS plugin will parse only the single-file ExtJS sources and not the *-all files (which we know would otherwise lead to multiple lookup and code-completion results).
I came up with the following setup for ExtJS' 'runtime' files, e.g. ext-all.js:
If you use IDEA's web module support putting this and other files inside your web module directory structure will have IDEA automatically parse them which is what we wanted to avoid in the first place.
Therefore I created a 'runtime' subfolder under libs/ext-3.3.1 and copied the relevant JS files plus the resources subfolder (CSS, images) there. Since libs/ext-3.3.1 is excluded from the project anyway, the JS plugin will not parse those files.
In order to have IDEA know that those files will be part of the deployed webapp, you will have to map this directory as a Web Resource Directory in Project Settings / Modules / Web, e.g.
[your-project-dir]/client/libs/ext-3.3.1/runtime -> /ext
IDEA will then know about these files and support e.g. auto-completion of paths to CSS or JS files when editing html files, and furthermore deploy those files when running one of the supported Application Servers (e.g. Tomcat) from within IDEA.
10 Aug 2011 10:32 AM #12IDEA will then know about these files and support e.g. auto-completion of paths to CSS or JS files when editing html files, and furthermore deploy those files when running one of the supported Application Servers (e.g. Tomcat) from within IDEA.
I handle this a couple of different ways using Apache Maven.
1) Use the Sencha CDN(Content Delibery Network) for downloading ext at runtime. IE: http://extjs.cachefly.net/ext-3.3.1/ext-all-debug.js. This allows me to use my local copy of ext just for auto-completion in IDEA and I don't have to worry about packaging Extjs inside my war because it gets downloaded directly from the CDN by connecting browsers.
2) Deploy a copy of the Extjs distribution zip file into you maven repository(I use Sonatype Nexus) and configure the maven war plugin to overlay the zip into the war during the packaging phase. I don't like this as well as the CDN approach, especially during development, because it makes the build a lot slower.In either case I use the maven tomcat plugin to run tomcat embedded in my IDE. I took this a step farther by setting Ext Designer to export directly into src/main/webapp folder of my maven project source tree, I used a jsp import to merge the contents of xds_includeOrder.txt into my index.jsp, I wrote a custom servlet filter which sets a no cache header in all responses, and created a maven build profile which disables the no cache servlet filter in non-development builds.This allows me to start an embedded tomcat, edit extjs code(with auto-completion), and export directly from the ext designer into my project. I can make a change to an ext component in the designer, export the code from the designer, refresh the browser page, and view the results without having to restart tomcat or manually clearing the browser cache. These steps have accelerated our development process considerably.
By bigice in forum Community DiscussionReplies: 3Last Post: 7 Jun 2010, 12:22 PM
By firstname.lastname@example.org in forum Community DiscussionReplies: 3Last Post: 6 Nov 2009, 8:21 AM
By avilanchee in forum Community DiscussionReplies: 13Last Post: 22 Jul 2009, 5:12 AM
By email@example.com in forum Community DiscussionReplies: 8Last Post: 10 Jul 2009, 10:02 AM
By Vaevictus in forum Community DiscussionReplies: 2Last Post: 30 Aug 2008, 9:12 AM