maven compilation error: duplicate classes

后端 未结 10 532
悲&欢浪女
悲&欢浪女 2020-12-09 16:39

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

When r

10条回答
  •  眼角桃花
    2020-12-09 17:07

    All answers here where not helpful. This may be the correct answer:

    Another StackOverflow user wrote:

    I have found an JetBrains Team member comment stating that:

    IDEA automatically excludes the build 'target' folder, providing that there are no generated sources under it, otherwise it excludes all sub-folders but the generated.

    Avro by standard in a generated-sources folder. This folder it not ignored by maven ans the generated classes in there will count as duplicate. Maven will only igonre the target folder by default.

    To fix add this line in the pom.xml:

     ${project.basedir}/src/main/target/resources/avro
    

    Context:

      org.apache.avro
                    avro-maven-plugin
                    ${avro.version}
                    
                        
                            generate-sources
                            
                                schema
                                protocol
                                idl-protocol
                            
                            
                                ${project.basedir}/src/main/target/resources/avro
                                String
                                false
                                ${project.basedir}/target/true
                                private
                            
                        
                    
    

    This will put the generated-resources folder under the target folder.

提交回复
热议问题