Uploaded image for project: 'Maven Enforcer Plugin'
  1. Maven Enforcer Plugin
  2. MENFORCER-283

Java 9 banDuplicateClasses incorrectly sees module-info.class as duplicate

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not A Problem
    • 1.4.1
    • None
    • Plugin
    • None

    Description

      When running the enforcer plugin with banDuplicateClasses rule against a project with dependencies on java-9 compatible libraries which include a module-info.class file, the plugin sees the multiple module-info files as duplicate classes.

      It should simply ignore these similar to package-info.

      In our projects, it is the dependencies on multiple libs from org.ow2.asm which provides the module-info class, rendering the following output:

      [WARNING] Rule 2: org.apache.maven.plugins.enforcer.BanDuplicateClasses failed with message:
      Duplicate classes found:
      
        Found in:
          org.ow2.asm:asm-tree:jar:6.0:compile
          org.ow2.asm:asm:jar:6.0:compile
          org.ow2.asm:asm-util:jar:6.0:compile
        Duplicate classes:
          module-info.class
      

      We can easily work around this problem for now by adding a global rule to ignore module-info such as the following but it would be nice if the enforces plugin ignored this file by default.

      <banDuplicateClasses>
      	<ignoreClasses>
      		<ignoreClass>module-info</ignoreClass>
      	</ignoreClasses>
      </banDuplicateClasses>
      

      Attachments

        Activity

          People

            khmarbaise Karl Heinz Marbaise
            buurman.sven@gmail.com Sven Haster
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: