创建GWT Maven项目 [英] Create a GWT Maven Project

查看:158
本文介绍了创建GWT Maven项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用Eclipse创建一个新项目,以便在maven 2系统下创建GWT应用程序。
我已经使用以下命令创建了项目:mvn命令

I'm trying to create a new project with Eclipse in order to create GWT application under maven 2 system. I have create the project with the follow mvn command

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

我已经安装了以下eclipse插件:
* m2eclipse
* egit
* gwt插件

I have installed the follow eclipse plugins: * m2eclipse * egit * gwt plugin

这里我的POM文件: p>

Here my POM file:

<?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>

我可以使用linux shell编译和部署我的应用程序,但是我有很多问题来构建和运行eclipse中的应用程序。

I can compile and deploy my application using the linux shell but I have many problems to build and run the application inside eclipse.

我没有找到任何教程,解释如何在eclipse中的maven内部逐步创建一个GWT应用程序。

I haven't found any tutorial that explain how to create step by step a GWT application under maven inside eclipse.

有人可以帮助我吗?

推荐答案

还有一个选项:


  • 使用Eclipse中的gwt插件创建一个gwt项目。现在你有一个Eclipse gwt项目。

  • Project Explorer 中选择项目,右键单击它,然后选择配置。然后选择转换为Maven项目。现在你得到一个gwt-maven项目。

  • 现在添加必要的依赖关系到 pom.xml

  • Make a gwt project by using the gwt plugin in Eclipse. Now you have an Eclipse gwt project.
  • Select the project in Project Explorer, right-click it, then choose Configure. Then select Convert to Maven Project. Now you get a gwt-maven project.
  • Now add necessary dependencies to pom.xml.

这篇关于创建GWT Maven项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆