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

Gre*_*nce 3 ant extjs maven sencha-cmd

我们正在进行更改以使用Sencha Cmd,但它使用Ant.我们将Maven用于其他事情,因此我们可以对配置文件或其他内容进行更改,因此Sencha Cmd使用Maven而不是Ant,或者我们必须安装Ant才能使用Sencha Cmd.

提前致谢.

Via*_*lov 7

您可以使用Sencha CMD使用Maven构建Sencha ExtJS项目.这很容易.检查我的示例项目Sencha ExtJS 5 + Sencha Cmd 5 + Maven:

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

Sencha ExtJS 5.0 BETA目前可用.阅读Sencha CMD文档并尝试实际操作.

然后只需将您的项目放在该webapp文件夹中,然后使用exec-maven-pluginSencha 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>
Run Code Online (Sandbox Code Playgroud)

如果要从生成的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>
Run Code Online (Sandbox Code Playgroud)