加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 无法使用带有gwt 2.2的GWT-maven-plugin成功创建项目

发布时间:2020-12-15 02:24:20 所属栏目:Java 来源:网络整理
导读:我正在按照 gwt-maven-plugin的文档和 Google Web Toolkit Blog上的文档来完成一个GWT项目,但没有成功. 使用eclipse 3.6,我使用archetype gwt-maven-plugin 2.1.0-1创建了一个新的maven项目 我按照这里发现的说明Google Web Toolkit Blog,但它不起作用.我得
我正在按照 gwt-maven-plugin的文档和 Google Web Toolkit Blog上的文档来完成一个GWT项目,但没有成功.

使用eclipse 3.6,我使用archetype gwt-maven-plugin 2.1.0-1创建了一个新的maven项目

我按照这里发现的说明Google Web Toolkit Blog,但它不起作用.我得到一个例外:

java.lang.NoClassDefFoundError: com/google/appengine/tools/enhancer/Enhance
Caused by: java.lang.ClassNotFoundException: com.google.appengine.tools.enhancer.Enhance
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
Exception in thread "main" 

我在谷歌eclipse插件中使用GAE 1.4.2中的gwt 2.2.0.我的pom.xml中使用了相同的版本号

这是生成的pom.xml.它使用2.1.0版本的gwt,但我手动将其更改为2.2.0

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <!-- POM file generated with GWT webAppCreator -->
  <modelVersion>4.0.0</modelVersion>
  <groupId>gwt-comet</groupId>
  <artifactId>gwt-comet-5</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>GWT Maven Archetype</name>

  <properties>
    <!-- Convenience property to set the GWT version -->
    <gwtVersion>2.2.0</gwtVersion>
    <!-- GWT needs at least java 1.5 -->
    <maven.compiler.source>1.5</maven.compiler.source>
    <maven.compiler.target>1.5</maven.compiler.target>
    <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet</artifactId>
      <version>2.2.0</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <version>2.2.0</version>
      <scope>provided</scope>
    </dependency>  
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.7</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <!-- Generate compiled stuff in the folder used for developing mode -->
    <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>

    <plugins>

      <!-- GWT Maven Plugin -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.1.0-1</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>test</goal>
              <goal>i18n</goal>
              <goal>generateAsync</goal>
            </goals>
          </execution>
        </executions>
        <!-- Plugin configuration. There are many available options,see gwt-maven-plugin 
          documentation at codehaus.org -->
        <configuration>
          <runTarget>Comet.html</runTarget>
          <hostedWebapp>${webappDirectory}</hostedWebapp>
          <i18nMessagesBundle>fr.client.Messages</i18nMessagesBundle>
        </configuration>
      </plugin>

      <!-- Copy static web files before executing gwt:run -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1.1</version>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>exploded</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <webappDirectory>${webappDirectory}</webappDirectory>
        </configuration>
      </plugin>

    </plugins>
  </build>

</project>

?

谢谢你的帮助.

解决方法

我没有和GAE一起使用它,但有一个更新版本的gwt-maven-plugin for 2.2.将其设置为2.2.0或删除版本标记,它将获取最新的标记. 你的pom中也没有任何GAE依赖.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读