-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[java-gradle-plugin] Gradle API not resolved when developing Gradle plugins with Java #3260
Comments
Thanks for the response, @jdneo! Okay, so as soon as I saw it worked for you, I cleaned as much as possible to isolate the problem. So I removed all other extensions related to Java, deleted all In the end, I found the real issue 😅 it seems the problem appears only when using the new API. To be exact, when the following line is used: As soon as line 54 is commented out, the problem disappears. To reproduce the issue, you need to be sure to answer
I'm also attaching a fresh newly generated project using the API: new-api-plugin.zip |
Thank you for sharing the project! Actually, I have some new findings with your attached project. And now it seems more like a bug of the extension, because of two reasons: Even if we do not comment out
It's only our extension that is not working with that. |
Awesome! I confirm the steps to use the new Gradle support work perfectly, and the issue has also disappeared. I'd love to keep using this new Gradle support as I mostly use Gradle on my projects. Is it ok to use the pre-release version until a stable one is released? Are there any "gotchas" I should try to be aware of? 🙂 |
It's ok to keep using the pre-release to get the latest enhancement and bug fix. If you meet any problem, you can file issue at https://github.com/microsoft/vscode-gradle/issues. In short, the new approach will delegate the build job to Gradle. The java extension is not responsible to generate .class files anymore. Gradle build tool will be used to do the compilation. In other word, we can say bye to the 'bin' folders. 😄 |
I'm closing this issue, feel free to raising questions or report bugs in https://github.com/microsoft/vscode-gradle/issues when you are using this new approach. |
@JoseLion please feel free to use this new feature in the pre-release version and let us know if there is any feedback. We aim to use this new feature and make Gradle experience as smooth as possible and love your feedback |
Awesome! I think this new approach is great, much better dev experience, and getting rid of the "bin" folders is big win too IMO. I'll keep using the pre-release with all my projects and I'll be more than happy to provide as much feedback as I can. Thanks for the help and for the great insight on this new feature! 🙂🎉 |
Thanks! Feel free to let us any time |
When developing Gradle plugins, the Gradle API is added by the
java-gradle-plugin
. Even though the project compiles with no problem, VSCode reportsThe import org.gradle cannot be resolved Java(268435846)
on every import of theorg.gradle.*
package. Weird enough, it seems VSCode does have access to any class imported by this package because if we try to go to the definition of the class (e.g. with Ctrl + Click), a decompiled .class file opens.Environment
Steps To Reproduce
gradle init
command4: Gradle plugin
in the first stepplugin\src\main\java\foo\FooPlugin.java
org.gradle.*
packageCurrent Result
VSCode shows
The import org.gradle cannot be resolved
on org.gradle.* importsExpected Result
VSCode should resolve org.gradle.* imports when the
java-gradle-plugin
plugin is appliedAdditional Informations
It seems this issue was already reported in the
vscode-gradle
repository more than a year ago, but was never moved here:microsoft/vscode-gradle#1257
The text was updated successfully, but these errors were encountered: