12

In JBoss AS 7 integration testsuite, we use JaCoCo for code coverage. I have the execution data already. Now when generating the report, I get "Can't add different class with same name: ..." So I have to exclude some jars.

<exclude name="org/jboss/osgi/framework/main/jbosgi-resolver-metadata-1.0.10.jar"/>

The problem is that only one class is duplicated (org/jboss/osgi/metadata/internal/AbstractPackageAttribute). I only want that particular class excluded, not whole jar.

I've tried:

 <exclude name="org/jboss/osgi/framework/main/**/AbstractPackageAttribute*"/>

But that doesn't work. Is there some special syntax, like .../foo.jar!**/ClassName.class?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277

1 Answers1

5

Use the zipfileset tag:

<sourcefiles>
  <zipfileset>
    <fileset dir="foo.jar">
      <exclude name="org/jboss/osgi/framework/main/**/AbstractPackageAttribute*.*"/>
    </fileset>
  </zipfileset>
</sourcefiles>
mkobit
  • 43,979
  • 12
  • 156
  • 150
rb512
  • 6,880
  • 3
  • 36
  • 55
  • 4
    where? inside of the jacoco-maven-plugin ? – Sergey Shcherbakov Sep 05 '19 at 10:26
  • Could you please add more information to this answer and explain how it solves the problem? – Per Mar 27 '21 at 16:05
  • @SergeyShcherbakov maybe [this answer](https://stackoverflow.com/questions/11673356/jacoco-cant-add-different-class-with-same-name-org-hamcrest-basedescription/67521056#67521056) will help you. – Philzen May 13 '21 at 14:33