【问题标题】:Simply GWT 2.3 and Maven2(3) project in Eclipse IndigoEclipse Indigo 中的简单 GWT 2.3 和 Maven2(3) 项目
【发布时间】:2011-10-23 07:10:56
【问题描述】:

当我尝试使用以下参数创建 Maven 项目时: 原型组 ID - org.codehaus.mojo; 原型工件 ID - gwt-maven-plugin; 原型版本 - 2.3.0-1。 我收到一些奇怪的错误:

  • 生命周期配置未涵盖插件执行:org.codehaus.mojo:gwt-maven-plugin:2.3.0-1:generateAsync(执行:默认,阶段:generate-sources)

    李>
  • 生命周期配置未涵盖插件执行:org.codehaus.mojo:gwt-maven-plugin:2.3.0-1:i18n(执行:默认,阶段:生成源)

    李>
  • 生命周期配置未涵盖插件执行:org.apache.maven.plugins:maven-war-plugin:2.1.1:exploded(执行:默认,阶段:编译)

还有一些警告:

  • 找不到项目方面 jst.web 的实现。功能将受到限制。

  • 找不到项目方面 wst.jsdt.web 的实现。功能将受到限制。

这是我的 pom.xml:

<?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>net.test1</groupId>
  <artifactId>TestWebApp</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.3.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.3.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>TestWebApp.html</runTarget>
          <hostedWebapp>${webappDirectory}</hostedWebapp>
          <i18nMessagesBundle>net.test1.TestWebApp.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>

等等。这是什么?我已经尝试了互联网上所有可能的手册,而且到处都是一样的。我尝试在没有 Eclipse 的情况下手动创建项目,并且相同。我认为,问题在于互联网上的手册是为旧版本的 Eclipse、Maven、GWT 编写的。我怎么能打败它?如何使用 GWT 2.3、Maven2 插件和 Eclipse Indigo 创建简单项目而不会出现错误结束警告?

【问题讨论】:

  • 我有类似的错误,但构建成功。我相信这些错误和警告来自 m2eclipse。你有安装 m2eclipse 吗?

标签: eclipse gwt maven


【解决方案1】:

这是已知的行为,在 eclipse wiki 上进行了讨论。见这里:http://wiki.eclipse.org/M2E_plugin_execution_not_covered

不要只是注释掉你的 pom 中有问题的部分,你确实需要它们。例如,在 pom 中为该 maven-war-plugin 生成的注释是“在执行 gwt:run 之前复制静态 Web 文件”事实证明这是真的。如果您注释掉该插件和“mvn clean gwt:run”,静态文件将不会被复制到目标文件夹并且无法用于托管模式。

幸运的是,解决方法很简单。如果您在 Eclipse 中打开 pom,请查看 Overview 部分,然后单击顶部的错误消息,它将为您提供一些快速修复选项。例如“将 pom.xml 中爆炸的目标永久标记为已忽略”。这将为您的 pom 添加一些 m2e 配置,因此它不再被标记为错误,并且一切都会像以前一样工作。您的 pom 中新生成的部分在上面的链接中描述为“忽略”选项。

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2011-11-16
    • 2011-09-15
    • 1970-01-01
    • 2012-06-03
    • 1970-01-01
    • 2011-09-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多