我正在尝试将GWT与接缝集成。我跟随 文档 并试图运行

示例如下。

  1. 我使用Eclipse Galileo创建了一个GWT项目,并创建了示例中给出的类

  2. 然后,我在构建路径中添加了接缝2.0.2罐

  3. 我使用Eclipse UI使用Google GWT编译器编辑了该应用程序。

  4. 最后,我运行了该应用程序。

首先,我想知道上述步骤是否正确。运行应用程序后,我没有得到所需的结果。

这也是将GWT与接缝集成的唯一方法吗?

更新

我已经使用蚂蚁运行了这个示例。但是我的锻炼目的是通过Eclipse UI运行它。

我用名称Gwttest创建了自己的项目,并试图在Eclipse中重新创建该示例

UI。我注意到了一些事情。 GWT通过Eclipse UI编译,在战争文件中使用名称GWTTEST创建一个目录。蚂蚁创建的目录结构是不同的。

在示例中

String endpointURL = GWT.getModuleBaseURL() + "seam/resource/gwt";

如何修改此代码以适合我的目录结构?

有帮助吗?

解决方案

我们使用Seam+Richfaces+GWT,并且效果很好。尽管我们用Maven构建所有东西,但我想您也可以使用蚂蚁。总体想法是在GWT开发模式下启动整个Web应用程序。您不必编译所有内容(在GWT编译器的情况下需要很长时间)。开发模式将按需编译请求的资源。通过以这种方式运行GWT应用程序,您还可以调试客户端代码。

还可以根据接缝操作调用GWT方法。

更新:

我可以详细说明我们的解决方案:

小牛

您的项目应配置 packaging: war. 。有一些关于用Maven(也有Richfaces)设置接缝的官方说明:

http://docs.jboss.org/seam/2.2.1.cr2/reference/en-us/html/depperencies.html#d0e34791

http://docs.jboss.org/richfaces/latest_3_3_3_x/en/devguide/html/settingsfordforderentenvironments.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友好的码头发射器,在某些情况下可能是必要的。

我希望它对您有帮助。您对GWT和Richfacaes应用程序之间的沟通感兴趣吗?

其他提示

如果愿意,请看一下 u003CSEAM_HOME>/示例/远程/GWT. 。从那里运行(确保在使用蚂蚁之前已经安装了蚂蚁)

ant

这里是readme.txt文件

您可以在: http:// localhost:8080/seam-helloworld/org.jboss.seam.seam.example.remoting.gwt.helloworld/helloworld.html

GWT: 如果您想重建GWT前端,则需要下载GWT,并配置build.properties指向它. 。然后,您可以从此目录运行“ Ant GWT compile”。默认情况下是预先构建的。 如果要使用GWT托管模式, ,好吧,从GWT文档中阅读所有有关它的信息!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top