maven compilation error: duplicate classes

2020-02-05 06:34发布

In my maven2 project I have a directory ${basedir}/autogen that contains some autogenerated source code files produced by wsdl2java.

When running mvn compile I get an compilation error, because of duplicate classes, that lives in ${basedir}/autogen. This is true. But what is the compilation phase doing in ${basedir}/autogen? I have not told maven to add this directory as a source directory. And there seems to be no way of telling maven to ignore the directory.

9条回答
女痞
2楼-- · 2020-02-05 07:07

I resolve it by remove generateAsync from my pom.xml the the GWT plugin will look like

                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwtVersion}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test</goal>
                            <!-- <goal>i18n</goal> -->

                        </goals>
                    </execution>
                </executions>
查看更多
爷、活的狠高调
3楼-- · 2020-02-05 07:13

Its hard to change default maven behaviour, i think its better to go with it - you could generate those files with maven wsdl2java-maven-plugin

查看更多
在下西门庆
4楼-- · 2020-02-05 07:14

I resolve the same issue

  1. cleaning maven project :-mvn clean
  2. delete com folder from src then compile
  3. copy com from generated to src->main-->java
  4. again compile

Hope this Help..

查看更多
登录 后发表回答