我在尝试创建一个可以在 Eclipse 中使用的简单 GWT + Maven 项目时遇到了很多问题。这是我在做什么:
gwt-maven-plugin
项目:mvn archetype:generate -q -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.0-rc2 -DgroupId=myGroupId -DartifactId=myArtifactId -Dversion=1.0 -Dmodule=myModule
但是,我收到以下错误:
在 Eclipse 中没有找到处理 gwt-maven-plugin:2.5.0-rc2:generateAsync 的市场条目。请参阅帮助以获取更多信息。
在 Eclipse 中没有找到处理 gwt-maven-plugin:2.5.0-rc2:i18n 的市场条目。请参阅帮助以获取更多信息。
我不明白这个错误信息。我找到了一个 related question on SO ,但将建议的片段添加到我的 pom.xml 似乎没有做任何事情。
任何人都可以透露一些信息吗?
最佳答案
您应该告诉 m2e 忽略这些警告。一旦你执行了一个目标,异步和 i18n 目标就会自动执行,这只是 maven/eclipse 不能很好地一起玩的经典案例。
在项目的构建部分中附加 pluginManagement(在 plugins 元素之后)
<plugins>
your maven plugins here
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>
gwt-maven-plugin
</artifactId>
<versionRange>
[2.4.0,)
</versionRange>
<goals>
<goal>i18n</goal>
<goal>generateAsync</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
最后将文件夹 target/generated-sources/gwt 添加到构建路径
关于eclipse - 在 Eclipse 中使用 GWT + Maven 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13060569/