Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sencha Windows SDK Tool 2.0.0. Maven integration

Have someone used ExtJs 4 with maven ? As for now, the Sencha SDK tool work only with a deployed and started webapp (it's a java webapp), even in this case the generated app-all.js does not contain all dependencies and Ext download a lot of dep. at runtime. What I need is to somehow integrate the production file generation in the build process.

like image 992
Bax Avatar asked Nov 04 '22 02:11

Bax


2 Answers

You can provide the resources (in this case Ext JS 4) just like other resources (html, images, css, other javascript).

There are some solutions or ideas how to provide a Maven solution.

  • https://github.com/ffrr/extjs-maven-plugin
  • http://www.sencha.com/forum/showthread.php?179849-New-to-ExtJS-with-Maven
  • http://www.sencha.com/forum/showthread.php?192915

In addition to this, the latest version will be Sencha Cmd 3 (formly SDK Tools), so look into http://www.sencha.com/forum/forumdisplay.php?8-Sencha-Cmd

--

In my opinion, you can stick with the simple way of just adding the stuff like resources. If you want to build, you can execute a script and/or the Sencha SDK/Cmd executable within Maven (e.g. maven-exec-plugin).

So, if you thought there would be a simple Sencha Maven Plugin initializing the SDK Tools right from the pom.xml: No. ;)

like image 195
knalli Avatar answered Nov 30 '22 17:11

knalli


You can build your Sencha ExtJS project with Maven using Sencha CMD. It's rather easy. Check my example project Sencha ExtJS 5 + Sencha Cmd 5 + Maven:

https://github.com/dobromyslov/sencha-extjs-maven

Sencha ExtJS 5.0 BETA available at the moment. Read Sencha CMD docs and try it in action.

Then just put your project in the webapp folder and use exec-maven-plugin to build your ExtJS application with Sencha CMD like this:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
    <execution>
        <id>sencha-compile</id>
        <phase>compile</phase>
        <goals>
            <goal>exec</goal>
        </goals>
        <configuration>
            <!-- Set path to your Sencha Cmd executable-->
            <executable>../Sencha/Cmd/5.0.0.116/sencha</executable>
            <arguments>
                <argument>-sdk</argument>
                <argument>${basedir}/src/main/webapp</argument>
                <argument>app</argument>
                <argument>build</argument>
                <argument>--clean</argument>
                <argument>--environment</argument>
                <argument>${sencha.env}</argument>
                <argument>--destination</argument>
                <argument>${basedir}/src/main/webapp/build</argument>
            </arguments>
        </configuration>
    </execution>
</executions>

If you want to purge unnecessary files from the resulting WAR file then use maven-war-plugin with configured exclusions like this:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <webResources>
        <resource>
            <directory>src/main/webapp/build/${sencha.env}/MyApp</directory>
            <excludes>
                <exclude>**/Readme.md</exclude>
            </excludes>
        </resource>
    </webResources>
    <packagingExcludes>.sencha/**,app/**,build/**,ext/**,overrides/**,packages/**,sass/**,bootstrap.css,bootstrap.js,bootstrap.json,build.xml,Readme.md</packagingExcludes>
</configuration>

like image 39
Viacheslav Dobromyslov Avatar answered Nov 30 '22 18:11

Viacheslav Dobromyslov