PDA

View Full Version : New to ExtJS with Maven



hdave
9 Feb 2012, 11:43 AM
I am new to Javascript, but have a lot of experience with Java, Actionscript, and Maven. My project currently uses Maven as our build tool.

I am just starting to look into how to structure and tool-up for an Ext-JS project that we will add as part of a WAR maven module.

Is anyone here already doing that? I've searched around and can't find a lot on this subject. I also cannot find any Ext-JS javascript maven artifacts in Maven central. Is there another repo I should be looking at or do I not understand something?

viniciuscs
9 Feb 2012, 12:01 PM
Hi hdave, i'm starting a java project using Maven and Ext JS 4 as well. First, you will not find the 'dependencies' of Ext JS in any maven repositories since it main purpose is to provide java artifacts and project archetypes. So, you will need to download the zip file of the most recent version of Ext JS and set up the directories structure for yourself as far as i know. Follow the links below for more details:

Download Ext JS:
http://www.sencha.com/products/extjs/download/ext-js-4.0.7/1234

(http://www.sencha.com/products/extjs/download/ext-js-4.0.7/1234)Getting Started Guide where you will find the application structure mentioned above:
http://docs.sencha.com/ext-js/4-0/#!/guide/getting_started

hdave
9 Feb 2012, 2:24 PM
Hi,

I found this Javascript Maven plugin which looks like it could help:

http://mojo.codehaus.org/javascript-maven-tools/javascript-maven-plugin/

My guess at this point is that I will need to manually create Ext JS maven artifacts in my corporate Nexus server and then find a way to dynamically load them from within the web app.

skirtle
11 Feb 2012, 9:27 PM
Currently there's no official POM for ExtJS and Maven. I just wrapped it up in my own POM and everything worked fine. In the application I used overlays to pull in the files I needed:


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<overlays>
<overlay>
<groupId>...group here...</groupId>
<artifactId>ext-js</artifactId>
<includes>
<include>ext-all-debug.js</include>
</includes>
<targetPath>static/lib/Ext/js</targetPath>
</overlay>
<overlay>
<groupId>...group here...</groupId>
<artifactId>ext-js-resources</artifactId>
<includes>
<include>css/ext-all.css</include>
<include>themes/images/default/**</include>
</includes>
<targetPath>static/lib/Ext/resources</targetPath>
</overlay>
</overlays>
</configuration>
</plugin>

I haven't tried the plugin you mentioned so I can't comment as to whether that provides a better solution.

hdave
12 Feb 2012, 6:22 PM
Currently there's no official POM for ExtJS and Maven. I just wrapped it up in my own POM and everything worked fine. In the application I used overlays to pull in the files I needed:


Interesting approach -- I think I will go with this for the time being. Frankly the Javascript mojos available on the codehaus website are not exactly filling me with confidence. The documentation is sketchy and the archetypes have not worked. I haven't tried jslint however, but that one seems like it could be ready for prime time.

Can I ask if you use any maven plugins to analyze code quality or do unit testing?

skirtle
13 Feb 2012, 4:34 AM
I rely on my IDE for analyzing JS code quality. For Java I've used PMD in the past though I don't recall whether I ever integrated it with a Maven project.

For testing I've used some home-grown tools that wire JavaScript tests into JUnit. If I were starting a new project now I'd probably re-evaluate the Maven support for direct JavaScript testing via Jasmine or similar.