Integrating Sencha Cmd compiling with Maven

Until now we have executed the Sencha Cmd compile command from the terminal. It would be far better to execute the command during the Maven build process. The index-prod.html and compiled all-classes.js files can then be generated automatically every time a build is performed. The following plugin when added to the Maven pom.xml file will perform the following action:

<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>
        <executable>C:SenchaCmd4.0.0.203sencha.exe</executable>
        <arguments>
          <argument>-sdk</argument>
          <argument>${basedir}/src/main/webapp/ext</argument>                                
          <argument>compile</argument>
          <argument>-classpath</argument>
          <argument>${basedir}/src/main/webapp/app</argument>
          <argument>page</argument>
          <argument>-yui</argument>
          <argument>-in</argument>
          <argument>${basedir}/src/main/webapp/index-dev.html</argument>
          <argument>-out</argument>
          <argument>${basedir}/src/main/webapp/index-prod.html</argument>
          </arguments>
      </configuration>
    </execution>
  </executions>
</plugin>

The following are a few points to note:

  • The plugin is executed during the compile phase of the Maven build process.
  • The Sencha Cmd executable is defined with a complete filesystem path. Only then is it possible to build different projects with different versions of Sencha if required.
  • The ${basedir} property represents the full path to the root of the Maven project. Full paths are required for each argument as we are not executing the Sencha Cmd compile command from within the webapp directory.

The index-prod.html and all-classes.js files will now be updated every time a build is performed. The output of this plugin can be seen in the following Maven build log:

Integrating Sencha Cmd compiling with Maven
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.176.166