0

gwt-maven-pluginの指示に従い、以下のプロジェクトを生成してインポートし、

1) プロジェクトを生成する

$ mvn archetype:generate \
   -DarchetypeGroupId=org.codehaus.mojo \
   -DarchetypeArtifactId=gwt-maven-plugin \
   -DarchetypeVersion=2.5.0

...

Define value for property 'groupId': : org.codehaus.mojo
Define value for property 'artifactId': : gwt-maven-plugin-sample
Define value for property 'version':  1.0-SNAPSHOT: : 
Define value for property 'package':  org.codehaus.mojo: : 
Define value for property 'module': : Sample 

...

2) 生成された POM を確認する

<?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>org.codehaus.mojo</groupId>
  <artifactId>gwt-maven-plugin-sample</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>GWT Maven Archetype</name>

  <properties>
    <!-- Convenience property to set the GWT version -->
    <gwtVersion>2.5.0</gwtVersion>
    <!-- GWT needs at least java 1.5 -->
    <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet</artifactId>
      <version>${gwtVersion}</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <version>${gwtVersion}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.7</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.0.0.GA</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.0.0.GA</version>
      <classifier>sources</classifier>
      <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.5.0</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>Sample.html</runTarget>
          <hostedWebapp>${webappDirectory}</hostedWebapp>
          <i18nMessagesBundle>org.codehaus.mojo.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>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>

3) 生成されたプロジェクトを確認する

gwt-maven-plugin-sample/
├── .classpath
├── pom.xml
├── .project
├── SampleTest-dev.launch
├── SampleTest-prod.launch
├── .settings
│   ├── com.google.appengine.eclipse.core.prefs
│   ├── com.google.gdt.eclipse.core.prefs
│   ├── com.google.gwt.eclipse.core.prefs
│   ├── .jsdtscope
│   ├── org.eclipse.jdt.core.prefs
│   ├── org.eclipse.wst.common.component
│   ├── org.eclipse.wst.common.project.facet.core.xml
│   ├── org.eclipse.wst.jsdt.ui.superType.container
│   └── org.maven.ide.eclipse.prefs
├── src
│   ├── main
│   │   ├── java
│   │   │   └── org
│   │   │       └── codehaus
│   │   │           └── mojo
│   │   │               ├── client
│   │   │               │   ├── GreetingService.java
│   │   │               │   └── Sample.java
│   │   │               ├── server
│   │   │               │   └── GreetingServiceImpl.java
│   │   │               └── shared
│   │   │                   └── FieldVerifier.java
│   │   ├── resources
│   │   │   └── org
│   │   │       └── codehaus
│   │   │           └── mojo
│   │   │               ├── client
│   │   │               │   ├── Messages_fr.properties
│   │   │               │   └── Messages.properties
│   │   │               └── Sample.gwt.xml
│   │   └── webapp
│   │       ├── Sample.css
│   │       ├── Sample.html
│   │       └── WEB-INF
│   │           └── web.xml
│   └── test
│       ├── java
│       │   └── org
│       │       └── codehaus
│       │           └── mojo
│       │               └── client
│       │                   └── GwtTestSample.java
│       └── resources
│           └── org
│               └── codehaus
│                   └── mojo
│                       └── SampleJUnit.gwt.xml
└── target
    └── generated-sources
        └── gwt
            └── org
                └── codehaus
                    └── mojo

33 directories, 26 files

4) Eclipse で、[既存のプロジェクトをワークスペースにインポート] を選択します。

輸入された日食プロジェクト

5) gwt-maven-pluginの指示によると、インポートされたプロジェクトは以下のようなプロジェクト構造になっているはずです。

期待日食プロジェクト

最後に、4) と 5) を比較すると、インポートによって Maven の依存関係がまったく追加されていない、つまり、生成されたプロジェクトが Maven プロジェクトとして検証されていないという問題が見えてきます。では、上記の手順と以下の構成のどこが間違っているのでしょうか?

gwt-maven-plugin 2.5.0
m2e 1.2.0.20120903-1050
eclipse 3.7.2
maven 3.0.4

@編集

"mvn gwt:run" は正常に実行されましたが、起動DevModeに失敗しましたGWT Eclipse Plugin

gwt devmode エラー

@EDIT 2

からのリンクを参照して、公式の GWT Wiki@Sachin Shekhar Rを調べました。maven を使用し、指示に従い、DynaTable RequestFactory sampleをテストしました。素晴らしい、それはうまくいきます!

残念ながら、使用中の Wiki エコーにgwt-maven-pluginは問題がありarchetypeます。

4

1 に答える 1

1

gwt-maven-plugin 2.5.0 は、GWT 2.5.0 で最適に動作します。Ran "mvn gwt:run" successfully, but failed to launch DevMode by GWT Eclipse Plugin というステートメントは少し混乱します。

私はあなたの場合にも気づきました-

1) で生成された pom ファイルは 2.5.0 を示し、Eclipse のスクリーンショットは 2.0.4 を示します。これは、GPE が GWT 2.0.4 を指しており、pom ファイル ディレクティブをオーバーライドしていることが原因である可能性があります。

2) maven gwt:run を使用している場合、GWT Eclipse プラグインは無関係です。開発モードはによって起動eitherされます

  • a)mvn gwt:run
  • Debug Asb)プロジェクトを右クリックして->を選択すると、GWT Eclipse PluginによってWeb Application

3) Maven の依存関係は、共有したスクリーンショットに表示されています。それを展開して、どの瓶が拾われているかを確認できますか.

Edit- http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMavenで追加のトラブルシューティングのヒントを試すことができます

私の推測では、構成@ Project properties, Google > Web Application, the "This project has a WAR directory"

于 2012-11-30T15:05:45.633 に答える