maven - 我可以使用 Maven 和 Sencha Cmd 而不是 Ant,还是必须使用 Ant?

标签 maven extjs ant sencha-cmd

我们正在更改以使用 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/

相关文章:

java - 如何设置maven项目?

java - 使用本地 fork 的 Maven 方法是什么?

javascript - 在 Sencha touch 中设置搜索字段上的列表值

javascript - 无法对过滤后的网格面板进行排序(带 fiddle )

java - 安装 Ant ;明显误解了JAVA_HOME

java - 无法将 maven 属性传递给 ant run 插件

java - 如何在本地 lib 目录中确定此 jar 的 maven 坐标?

java.lang.NoClassDefFoundError : TestProtos/AuthMethodResponseProto 错误

Javascript - ExtJs - 如何在数据网格中每第 n 行添加自定义行?

java - 无法编译 .java 代码,未进行任何更改