GWT Maven Eclipse Plugin - Compilation Fails Due to Duplicate Class

sdoca :

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

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

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!

sdoca :

I have found this posting which states:

If you manually create the Async interface you must disable the generateAsync goal in the plugin configuration

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>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Maven Compilation for GWT 2.7 SOYC Fails

gwt-maven-plugin fails with NullPointerException

Maven+Eclipse compilation fails, Maven compilation on terminal works

maven-pmd-plugin execution fails due to "Absent Code attribute in method that is not native or abstract in class file"

codehaus.mojo gwt-maven-plugin: project fails to compile

gwt-maven-plugin: Compile fails "with status 1"

Maven compilation fails with "cannot find symbol" while with Eclipse, it compiles

New GWT maven plugin

GWT Maven plugin: Generating non-String parameters in the Messages class

Maven GWT 2.0 and Eclipse

jspc-maven-plugin cannot compile due to missing class

Maven: compilation module fails

Maven compilation jibx plugin

Linker fails due to duplicate symbol

Kotlin maven plugin order of compilation

net.ltgt.gwt.maven:gwt-maven-plugin with Lombok

Eclipse Maven - Code Completion fails "This compilation unit is not on the build path of a Java project" and "Failed to Download Index" Error

Maven compilation failes (but compilation under Eclipse is successful)

Maven compilation complication due to complex folder structure

Maven Incremental Compilation under Eclipse

maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

Failed to execute goal (GWT Maven Plugin)

gwt maven plugin deploy to standalone tomcat not loading

Setting workDir for gwt codeserver with tbroyer maven plugin

Not able to install GWT Plugin as of May 2018 in eclipse

GWT-Maven-plugin: Link GWT compiled files into a defined directory

Artifactory maven plugin fails to deploy

maven-bundle-plugin fails with "Invalid class file module-info.class"

Selenium compilation error due to bad class file

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  3. 3

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  4. 4

    pump.io port in URL

  5. 5

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    Do Idle Snowflake Connections Use Cloud Services Credits?

  9. 9

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  10. 10

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  11. 11

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  12. 12

    Generate random UUIDv4 with Elm

  13. 13

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  14. 14

    Is it possible to Redo commits removed by GitHub Desktop's Undo on a Mac?

  15. 15

    flutter: dropdown item programmatically unselect problem

  16. 16

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  17. 17

    EXCEL: Find sum of values in one column with criteria from other column

  18. 18

    Pandas - check if dataframe has negative value in any column

  19. 19

    How to use merge windows unallocated space into Ubuntu using GParted?

  20. 20

    Make a B+ Tree concurrent thread safe

  21. 21

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

HotTag

Archive