2011-06-30 11 views
4

Eclipseで新しいプロジェクトを作成して、Maven 2システムでGWTアプリケーションを作成しようとしています。ここに私のPOMファイル* m2eclipse * egit *のGWTプラグインGWT Mavenプロジェクトを作成します。

<?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>com.mobc3.paperquid</groupId> 
    <artifactId>Backoffice</artifactId> 
    <packaging>war</packaging> 
    <version>1.0.0-SNAPSHOT</version> 
    <name>GWT Maven Archetype</name> 

    <properties> 
    <!-- Convenience property to set the GWT version --> 
    <gwtVersion>2.3.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.3.0</version> 
     <scope>runtime</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.google.gwt</groupId> 
     <artifactId>gwt-user</artifactId> 
     <version>2.3.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.3.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>Backoffice.html</runTarget> 
      <hostedWebapp>${webappDirectory}</hostedWebapp> 
      <i18nMessagesBundle>com.mobc3.paperquid.backoffice.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> 
を私は従う日食のプラグインをインストールして、フォローMVN命令で

mvn archetype:generate -DarchetypeRepository=repo1.maven.org -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.3.0 

をプロジェクトを作成している

linuxシェルを使用してアプリケーションをコンパイルしてデプロイできますが、eclipse内でアプリケーションをビルドして実行するには多くの問題があります。

eclipse内のmavenでGWTアプリケーションをステップバイステップで作成する方法を説明するチュートリアルは見つかりませんでした。

誰かが私を助けることができますか?ここで

答えて

1

は、私は、GWTと私のGWTアプリケーションを実行していた私のポンポンのセットアップから関連する(と思う)セクションです:実行目標:

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>gwt-maven-plugin</artifactId> 
    <version>2.3.0</version> 
    <configuration> 
    <runTarget>/ModuleName.html</runTarget> 
    <modules> 
     <module>${project.groupId}.package.ModuleName</module> 
    </modules> 
    <copyWebapp>true</copyWebapp> 
    </configuration> 
    <executions> 
    <execution> 
     <configuration> 
     <extraParam>true</extraParam> 
     </configuration> 
     <goals> 
     <goal>compile</goal> 
     </goals> 
    </execution> 
    </executions> 
</plugin> 

私は今、GWTを使用していること、しかし、言うべき私のアプリをEclipse内で実行するためのEclipseプラグインです。この設定を使用してからしばらく時間がかかりました。私が読んで覚えているところから、 "copyWebapp" "true"は設定の重要な部分の1つです。また、gwt-maven-pluginが時々見つけられないので、モジュール名を直接指定するのにも役立ちました。

9

つ以上のオプション:

  • はEclipseでGWTプラグインを使用してGWTプロジェクトを作成します。これでEclipseのgwtプロジェクトが完成しました。
  • Project Explorerでプロジェクトを選択し、右クリックしてConfigureを選択します。次にConvert to Maven Projectを選択します。これでgwt-mavenプロジェクトが完成しました。
  • pom.xmlに必要な依存関係を追加します。
+0

あなたのアドバイスに続いて、Run As - >(Google)Webアプリケーションを使用してEclipseでプロジェクトを実行できます。しかし、私がRun As - > Run on Serverを試してみると、私は "禁止された"状態になります。誰かがこのエラーを理解して修正するのを助けることができますか? –

関連する問題