質問
GWTをSeamと統合しようとしています。私はそれに従いました ドキュメント そして、実行しようとしました
次のように例。
Eclipse Galileoを使用してGWTプロジェクトを作成し、例に記載されているクラスを作成しました
次に、ビルドパスにSeam 2.0.2 jarを追加しました
Eclipse UIを使用してGoogle GWTコンパイラを使用してアプリケーションをコンパイルしました。
最後にアプリケーションを実行しました。
最初に、上記の手順が正しいかどうかを知りたいです。アプリケーションを実行した後、私は望ましい結果が得られません。
また、これはGWTをSeamと統合する唯一の方法ですか?
アップデート
ANTを使用してこの例を実行しています。しかし、私の運動の目的は、Eclipse UIを介して実行することです。
名前gwttestで自分のプロジェクトを作成し、Eclipseで例を再現しようとしました
ui。私が気づいたことがいくつかあります。 Eclipse UI経由のGWTコンパイルは、戦争ファイル内に名前GWTTESTでディレクトリを作成します。 ANTによって作成されたディレクトリ構造が異なる場合。
例には、次のようにaskquestionWidget getService機能にコードがあります
String endpointURL = GWT.getModuleBaseURL() + "seam/resource/gwt";
ディレクトリ構造に合わせてこのコードを変更するにはどうすればよいですか?
解決
Seam+Richfaces+GWTを使用していますが、非常にうまく機能します。 Mavenですべてを構築しますが、Antも使用できると思います。一般的なアイデアは、GWT開発モードでWebアプリケーション全体を開始することです。すべてをコンパイルする必要はありません(GWTコンパイラの場合は長い時間がかかります)。開発モードは、要求されたリソースをオンデマンドでコンパイルします。この方法でGWTアプリケーションを実行することにより、クライアントサイドコードをデバッグすることもできます。
また、Seamアクションに応じてGWTメソッドを呼び出すこともできます。
アップデート:
私たちのソリューションについて少し詳しく説明することができます:
メイベン
プロジェクトはで構成する必要があります packaging: war
. 。 Maven(Richfaces)で縫い目を設定することに関する公式の指示がいくつかあります。
http://docs.jboss.org/seam/2.2.1.cr2/reference/en-us/html/dependencies.html#d0e34791
http://docs.jboss.org/richfaces/latest_3_3_x/en/devguide/html/settingsfordifferentenvironments.html
GWTについては、次のセクションを追加します pom.xml
:
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.1.0</version>
<scope>provided</scope> <!-- prevents from including this in war -->
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>2.1.0</version>
<scope>provided</scope> <!-- prevents from including this in war -->
</dependency>
<dependency>
<groupId>pl.ncdc.gwt</groupId>
<artifactId>gwt-servlet-war</artifactId>
<version>2.1.0</version>
<type>war</type> <!-- adds gwt-servlet.jar to your war, but not to your classpath -->
</dependency>
<!-- build section -->
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/client/**/*.java</include>
<include>**/client/**/*.properties</include>
<include>**/shared/**/*.java</include>
<include>**/shared/**/*.properties</include>
<include>**/*.gwt.xml</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/java</directory>
<includes>
<include>**/client/**/*.java</include>
<include>**/client/**/*.properties</include>
<include>**/shared/**/*.java</include>
<include>**/shared/**/*.properties</include>
<include>**/*.gwt.xml</include>
</includes>
</testResource>
</testResources>
<plugins>
<plugin> <!-- dirty hack for GWT issue #3439 - it is not really fixed -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>remove-javax</id>
<phase>compile</phase>
<configuration>
<tasks>
<delete dir="${project.build.directory}/classes/javax" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.3.2.google</version>
<configuration>
<extraJvmArgs>-Xmx512M</extraJvmArgs>
<gwtVersion>${gwt.version}</gwtVersion>
<modules>
<module>com.company.gwt.project.module.Module</module>
</modules>
<soyc>false</soyc>
<draftCompile>${gwt.draft.compile}</draftCompile> <!-- you can control this with profiles -->
<localWorkers>2</localWorkers><!-- in theory should speed things up on our quad CPU hudson -->
<style>${gwt.style}</style> <!-- you can control this with profiles -->
</configuration>
<executions>
<execution>
<id>compile</id>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>gwt-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>**/*GwtTestSuite.java</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
<configuration>
<archiveClasses>true</archiveClasses>
<warSourceDirectory>src/main/webapp-empty</warSourceDirectory> <!-- just empty dir for workaround -->
<webResources>
<resource>
<directory>src/main/webapp</directory>
<excludes>
<exclude>app.*</exclude> <!-- name of you gwt module(s) - rename-to in gwt.xml -->
<exclude>WEB-INF/web.xml</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>WEB-INF/web.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
この構成は、縫い目とGWTコンパイルされた両方で戦争を引き起こすはずです。開発モードでそのようなプロジェクトを使用したい場合 pom.xml
:
<dependency>
<groupId>com.xemantic.tadedon</groupId>
<artifactId>tadedon-gwt-dev</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
そして追加します -server com.xemantic.tadedon.gwt.dev.JettyLauncher
Google Webアプリケーションランチャーに。これは、状況によっては必要になる可能性のあるMavenフレンドリーなJetty Launcherです。
それがあなたを助けることを願っています。 GWTとRichfacaesアプリケーション間の通信に興味がありますか?
他のヒント
必要に応じて、見てください u003CSEAM_HOME>/例/remoting/gwt. 。そこから、実行する前にアリをインストールしたことを確認してください)
ant
readme.txtファイルを次に示します
次の例を表示できます。 http:// localhost:8080/seam-helloworld/org.jboss.seam.example.remoting.gwt.helloword/helloworld.html
GWT: GWTのフロントエンドを再構築する場合は、GWTをダウンロードし、Build.Propertiesを設定してポイントする必要があります。. 。その後、このディレクトリから「ANT GWTコンパイル」を実行できます。デフォルトで事前に構築されています。 GWTホストモードを使用する場合, 、まあ、GWTドキュメントからそれについてすべて読んでください!