GWT Maven Eclipse插件 - 由于重复的类编译失败 [英] GWT Maven Eclipse Plugin - Compilation Fails Due to Duplicate Class
问题描述
我正在使用安装了m2eclipse和GWT Eclipse插件的Eclipse 3.5(Galileo)。我使用gwt-maven-plugin原型创建了一个项目。我已经创建了一个使用这些类定义的RPC服务:
I am using Eclipse 3.5 (Galileo) with m2eclipse and GWT Eclipse plugins installed. I created a project using the gwt-maven-plugin archetype. I have created an RPC service defined with these classes:
my.package.client.DataService
my.package.client.DataServiceAsync
my.package.server.DataServiceImpl
当我运行 mvn clean
,目标目录被删除(作为exepected)。当我运行 gwt:compile gwt:run -X -e
,我收到错误:
When I run mvn clean
, the target directory is removed (as exepected). When I run gwt:compile gwt:run -X -e
, I get the error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project MyProject: Compilation failure
C:\Devel\EclipseProjects\MyProject\target\generated-sources\gwt\my\package\client\DataServiceAsync.java:[8,7] duplicate class: my.project.client.DataServiceAsync
-> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project MyProject: Compilation failure
C:\Devel\EclipseProjects\MyProject\target\generated-sources\gwt\my\package\client\DataServiceAsync.java:[8,7] duplicate class: my.project.client.DataServiceAsync
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:581)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeForkedExecutions(DefaultLifecycleExecutor.java:685)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:560)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:324)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
C:\Devel\EclipseProjects\MyProject\target\generated-sources\gwt\my\package\client\DataServiceAsync.java:[8,7] duplicate class: my.project.client.DataServiceAsync
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:577)
... 16 more
[ERROR]
[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/MojoFailureException
失败后,目标目录已创建,具有以下功能目录结构和其中的单个文件:
After the failure, the target directory has been created with the following directory structure and the single file in it as such:
MyProject/target/generated-sources/gwt/my/project/client/DataServiceAsync.java
由于在运行 gwt之前目标目录不存在:编译gwt:run -X -e
,必须创建目录,并将java类复制为执行目标的一部分。那么为什么目标现在会抱怨一个重复的类?
Since the target directory didn't exist before running gwt:compile gwt:run -X -e
, the directories must have been created and the java class copied as part of executing the goal. So, why would the goal now complain about a duplicate class?
任何帮助都是非常感谢!
Any help is greatly appreciated!
推荐答案
我发现这个帖子,其中指出:
如果手动创建Async界面,则必须禁用generateAsync插件配置中的目标
If you manually create the Async interface you must disable the generateAsync goal in the plugin configuration
修复程序是删除< goal> generateAsync< / goal>
从我的pom.xml。插件配置现在看起来像:
The fix was to remove <goal>generateAsync</goal>
from my pom.xml. The plugin config now looks like:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>my.package.Application/Application.html</runTarget>
</configuration>
</plugin>
这篇关于GWT Maven Eclipse插件 - 由于重复的类编译失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!