Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Hi,

We have a maven project which uses clover and axistools-wsdl2java plugin. Platfrom is windows.

We are using clover 2.4.0 plugin to get code coverage which integrated in project's pom.xml.

Configured the clover plugin as 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> 
  </executions> 
</plugin>

Also, there is axistools plugin used to generate classes using wsdl file, which is configured as 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 we execute a command 'mvn clean install' , compilation will go fine. Then first axistool's wsdl2java goal is ran and source files are generated in respective directory.

Next clover plugin tries to instrument the source code by running unit test cases, when this plugin places the instrumented source code under

{basedir}/target/clover/src/main/java/...

Then it fires "compile" goal to compile all the source code. While compiling the source code, two source paths are getting added i.e.

{basedir}/src/main/java/... and {basedir}/target/clover/src/main/java/... , both have same classes.

When maven compiler tries to compile these sources compilation is failing by throwing "Duplicate Class Error".

But when we comment out axistools plugin, clover instrumentation and report generation goes fine.

Thanks,

Gopal krishna

1 answer

0 votes

Hello Gopal,

1) Why do you generate source files into src/main/java?:

<outputDirectory>${base.dir}/src/main/java</outputDirectory>

It is very uncommon to define builds in such way in Maven. Generated sources are usually put into 'target/generated-sources/xxx'.

2) If you cannot change the location of generated sources for some reason, please try to run whole source generation before Clover instrumentation starts. Something like:

mvn clean axistools-maven-plugin:wsdl2java clover2:setup test clover2:aggregate clover2:clover

Cheers
Marek

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Opsgenie

Investigate deployment-related incidents with Bamboo and Opsgenie together

Back in April of last year one of the major product announcements from Opsgenie was the launch of the Incident investigation view which created a deep connection between Bitbucket and Opsgenie, empow...

112 views 1 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you