2011-08-09 34 views
6

當我嘗試使用以下參數創建Maven項目時: 原型組Id - org.codehaus.mojo; 原型神器Id - gwt-maven-plugin; 原型版本 - 2.3.0-1。 我得到一些奇怪的錯誤:只需在Eclipse Indigo中使用GWT 2.3和Maven2(3)項目

  • 插件運行不屬於生命週期配置:org.codehaus.mojo:GWT-Maven的插件:2.3.0-1:generateAsync(執行:默認情況下,階段:產生-sources)

  • 插件執行未包括生命週期配置:org.codehaus.mojo:GWT-行家-插件:2.3.0-1:I18N(執行:默認值,相:產生來源)

  • 生命週期配置沒有涉及的插件執行:org.apache.maven.plugins:maven-war-plugin:2.1 1.1:爆炸(執行:默認情況下,相:編譯)

而且一些警告爲:

  • 項目方面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> 

等。這是什麼?我已經在互聯網上嘗試過所有可能的手冊,並且在任何地方都一樣。我試圖創建項目manualy沒有日食和相同的。我認爲,問題在於互聯網上的手冊是爲老版本的Eclipse,Maven,GWT編寫的。我怎麼能打敗它?我如何才能創建簡單的項目與GWT 2.3,Maven2插件和Eclipse Indigo沒有錯誤結束警告?

+0

我有類似的錯誤,但構建成功。我相信這些錯誤和警告是從m2eclipse。你有沒有安裝m2eclipse? – Adi

回答

11

這是已知的行爲,在eclipse wiki上討論。請看這裏:http://wiki.eclipse.org/M2E_plugin_execution_not_covered

不要只是註釋掉你的pom中有問題的部分,你確實需要它們。例如,在pom中爲maven-war-plugin生成的註釋是「在執行gwt:run之前複製靜態網頁文件」。事實證明這是事實。如果你註釋掉這個插件和「mvn clean gwt:run」,靜態文件將不會被複制到目標文件夾並且不可用於託管模式。

幸運的是,解決方法很簡單。如果您在Eclipse中打開pom,請查看概述部分,然後單擊頂部的錯誤消息,它會給您一些快速修復選項。比如「永久性標記pom.xml中被忽略的目標」。這會爲你的pom添加一些m2e配置,所以它不會再被標記爲錯誤,並且一切都會像以前一樣工作。您的pom中新生成的部分是上面鏈接中描述的「忽略」選項。

希望這會有所幫助。

相關問題