GWT:Maven错误:jar必须是' pom'导入托管依赖项

时间:2015-03-28 12:37:53

标签: java maven gwt dependency-management

我使用webAppCreator制作了一个示例GWT应用。

运行任何mvn命令时,例如mvn package,我收到此错误:

[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'dependencyManagement.dependencies.dependency.type' for com.google.gwt:gwt:jar must be 'pom' to import the managed dependencies. @ line 21, column 19
[ERROR] 'dependencies.dependency.version' for com.google.gwt:gwt-servlet:jar is missing. @ line 34, column 17
[ERROR] 'dependencies.dependency.version' for com.google.gwt:gwt-user:jar is missing. @ line 39, column 17
[ERROR] 'dependencies.dependency.version' for com.google.gwt:gwt-dev:jar is missing. @ line 44, column 17
[ERROR] 'dependencies.dependency.version' for com.google.gwt:gwt-codeserver:jar is missing. @ line 49, column 17
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.babken.stockwatcher:StockWatcher:1.0-SNAPSHOT (/home/void/workspace/stockwatcher/pom.xml) has 4 errors
[ERROR]     'dependencies.dependency.version' for com.google.gwt:gwt-servlet:jar is missing. @ line 34, column 17
[ERROR]     'dependencies.dependency.version' for com.google.gwt:gwt-user:jar is missing. @ line 39, column 17
[ERROR]     'dependencies.dependency.version' for com.google.gwt:gwt-dev:jar is missing. @ line 44, column 17
[ERROR]     'dependencies.dependency.version' for com.google.gwt:gwt-codeserver:jar is missing. @ line 49, column 17
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

1 个答案:

答案 0 :(得分:1)

[WARNING]行说明了所有内容 - 您需要在<type>pom</type>中将dependencyManagement添加到pom.xml

打开pom.xml并更改以下部分:

  <dependencyManagement>
    <dependencies>
      <!-- ensure all GWT deps use the same version (unless overridden) -->
      <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt</artifactId>
        <version>${gwtVersion}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
    </dependencies>
  </dependencyManagement>

为:

  <dependencyManagement>
    <dependencies>
      <!-- ensure all GWT deps use the same version (unless overridden) -->
      <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt</artifactId>
        <version>${gwtVersion}</version>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

这是[{1}}:https://code.google.com/p/google-web-toolkit/issues/detail?id=9054中的已知错误。将GWT更新到最新版本。 (感谢Thomas Broyer)。