0

I have created a new gradle plugin project with gradle init (gradle version 6.1):

  1. Select type of project to generate:
    • Gradle plugin
  2. Select implementation language:
    • Java
  3. 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?

tangens
  • 39,095
  • 19
  • 120
  • 139

2 Answers2

2

I found this gradle issue. It seems that gradle plugins are not java 11 ready yet. I'll try switching back to java 8 for gradle plugin development.

tangens
  • 39,095
  • 19
  • 120
  • 139
1

Yes, it's a gradle issue. Works fine from command line and in IDEA but that's because of a JDK bug. Also check this eclipse bug discussion.