誰かが Maven で ExtJs 4 を使用しましたか? 今のところ、Sencha SDK ツールは、デプロイされて開始された webapp (Java webapp) でのみ動作します。この場合でも、生成された app-all.js にはすべての依存関係が含まれておらず、Ext は多くの dep をダウンロードします。実行時に。私が必要としているのは、プロダクション ファイルの生成をビルド プロセスに統合することです。
2 に答える
他のリソース (html、画像、css、その他の JavaScript) と同じように、リソース (この場合は Ext JS 4) を提供できます。
Maven ソリューションを提供するための解決策やアイデアがいくつかあります。
- https://github.com/ffrr/extjs-maven-plugin
- http://www.sencha.com/forum/showthread.php?179849-New-to-ExtJS-with-Maven
- http://www.sencha.com/forum/showthread.php?192915
これに加えて、最新バージョンは Sencha Cmd 3 (旧 SDK Tools) になるので、http://www.sencha.com/forum/forumdisplay.php?8-Sencha-Cmd を調べてください。
--
私の意見では、リソースのようなものを追加するだけの簡単な方法に固執することができます. ビルドしたい場合は、Maven 内でスクリプトおよび/または Sencha SDK/Cmd 実行可能ファイルを実行できます (例: maven-exec-plugin)。
したがって、pom.xml から直接 SDK ツールを初期化する単純な Sencha Maven プラグインがあると思っていた場合: いいえ。;)
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-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>