我们正在更改以使用 Sencha Cmd,但它使用 Ant。我们使用 Maven 来做其他事情,所以我们可以更改配置文件或其他东西,所以 Sencha Cmd 使用 Maven 而不是 Ant,或者我们必须安装 Ant 才能使用 Sencha Cmd。
提前致谢。
最佳答案
您可以使用 Sencha CMD 通过 Maven 构建 Sencha ExtJS 项目。这很容易。 检查我的示例项目 Sencha ExtJS 5 + Sencha Cmd 5 + Maven:
https://github.com/dobromyslov/sencha-extjs-maven
Sencha ExtJS 5.0 BETA available眼下。 阅读 Sencha CMD docs并在行动中尝试。
然后只需将您的项目放入 webapp
文件夹中,并使用 exec-maven-plugin
使用 Sencha CMD 构建您的 ExtJS 应用程序,如下所示:
<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>
如果您想从生成的 WAR 文件中清除不必要的文件,请使用 maven-war-plugin
并配置如下排除项:
<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>
关于maven - 我可以使用 Maven 和 Sencha Cmd 而不是 Ant,还是必须使用 Ant?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21766127/