I have created a new gradle plugin project with gradle init
(gradle version 6.1):
- Select type of project to generate:
- Gradle plugin
- Select implementation language:
- Java
- Select build script DSL:
- Groovy
Then in Eclipse version 2019-09 R (4.13.0) running with openjdk 11.0.5 I have imported this project as an "existing gradle project".
This project compiles without errors from the command line (gradle build
) and also within Eclipse.
Now I add the following line to the source of the created plugin class:
import javax.xml.parsers.DocumentBuilderFactory;
From the command line this compiles without errors again. But Eclipse produces the error message:
The package javax.xml.parsers is accessible from more than one module: <unnamed>, java.xml
The second source for package javax.xml.parsers
seems to be gradle-api-6.1.jar
, that is automatically included when applying the gradle-plugin
-Plugin.
I tried the suggested solutions from this answer, but they don't seem to work for the development of a gradle-plugin.
What can I do to make the Eclipse problems go away?