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:
compile
phase of the Maven build process.${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:
3.137.176.166