Eclipse is confused by imports (“accessible from more than one module”)

前端 未结 6 1731
予麋鹿
予麋鹿 2020-11-29 08:48

When referencing simple .jar files, Eclipse shows an error stating:

The package java.awt is accessible from more than one module: , jav

6条回答
  •  借酒劲吻你
    2020-11-29 09:11

    See also: The package org.w3c.dom is accessible from more than one module: , java.xml where I answered:

    Disappointingly I don't see any compiler flags to show what jar the problem is with Even -Xlint:module doesn't seem to show up anything useful and eclipse doesn't shed any light on the issue

    Instead to find where java.awt comes from I've been using this script:

    mvn dependency:copy-dependencies -DincludeScope=test -DoutputDirectory=deps
    for i in deps/*.jar; do if unzip -l $i| grep -q java.awt; then echo $i; fi ; done
    

    Strictly you don't have to specify the scope test as that's the default but I've included it as you might want to use compile instead

提交回复
热议问题