Duplicate class error when both axistools and clover plugin are included in maven project -


we have maven project uses clover , axistools-wsdl2java plugin. platfrom windows.

we using clover 2.4.0 plugin code coverage integrated in project's pom.xml. configured clover plugin shown below.

<plugin>      <groupid>com.atlassian.maven.plugins</groupid>      <artifactid>maven-clover2-plugin</artifactid>      <version>2.4.0</version>      <configuration> <generatepdf>true</generatepdf>      <generatexml>true</generatexml>      <generatehtml>true</generatehtml>      <licenselocation>c:/ecassvnco/ews/ews-mvn/ewsbase/src/test/resources/license/clover.license</licenselocation>      <reportdescriptor>c:/ecassvnco/ews/ews-mvn/ewsbase/src/test/resources/descriptor/default-clover-report.xml</reportdescriptor>      <excludes>          <exclude>${basedir}/src/main/java/*.java</exclude>      </excludes>      </configuration>          <executions>              <execution>                  <id>install</id>                  <phase>install</phase>                  <goals>                      <goal>instrument</goal>                      <goal>clover</goal>                  </goals>              </execution>              <!--             <execution>                  <id>test</id>                  <phase>test</phase>                  <goals>                      <goal>instrument</goal>                      <goal>clover</goal>                  </goals>               </execution>               <execution>                  <id>site</id>                  <phase>pre-site</phase>                  <goals>                      <goal>instrument</goal>                      <goal>clover</goal>                 </goals>             </execution>              -->         </executions>  </plugin> 

also, there axistools plugin used generate classes using wsdl file, configured below.

<plugin>     <groupid>org.codehaus.mojo</groupid>     <artifactid>axistools-maven-plugin</artifactid>     <version>1.4</version>     <configuration>         <sourcedirectory>${base.dir}/src/main/resources/wsdl</sourcedirectory>         <outputdirectory>${base.dir}/src/main/java</outputdirectory>         <wsdlfiles>             <wsdlfiles>wsecas.wsdl</wsdlfiles>         </wsdlfiles>           <packagespace>com.symantec.wsecas</packagespace>         <testcases>true</testcases>         <serverside>true</serverside>         <phase>install</phase>         <subpackagebyfilename>true</subpackagebyfilename>     </configuration>     <executions>         <execution>             <goals>                 <goal>wsdl2java</goal>             </goals>         </execution>     </executions> </plugin> 

when execute command 'mvn clean install' , compilation go fine. first axistool's wsdl2java goal ran , source files generated in respective directory. next clover plugin tries instrument source code running unit test cases, when plugin places instrumented source code under {basedir}/target/clover/src/main/java/... fires "compile" goal compile source code. while compiling source code, 2 source paths getting added i.e. {basedir}/src/main/java/... , {basedir}/target/clover/src/main/java/... , both have same classes. when maven compiler tries compile these sources compilation failing throwing "duplicate class error".

but when comment out axistools plugin, clover instrumentation , report generation goes fine.

if of have come across similar issue 'duplicate class error', please guide on regard. suggestion , appreciated.

it seems problem axis plugin generates sources src/main/java (it should rather target/src-generated).

when clover invoked first take 'normal' sources src/main/java, instrument them , put target/clover/java. next clover change list of source roots replacing src/main/java target/clover/java.

next axis code generation comes play , generates new sources again src/main/java adding directory source root.

as consequence compiler sees same set of sources (i.e. non-generated ones) in 2 locations , complains it.

this case similar 1 described in clover's knowledge base:

https://confluence.atlassian.com/display/cloverkb/duplicate+class+errors+with+clover+and+jaxb+or+jaxb2+plugin

https://confluence.atlassian.com/display/cloverkb/duplicate+class+errors+with+clover+and+jaxws-maven+plugin

you find possible solutions in these articles.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -