-
Notifications
You must be signed in to change notification settings - Fork 430
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
Gradle compiles but vscode-java is getting compilation errors #797
Comments
That one is really weird. Same project builds fine in Eclipse. The classpath seems to be set correctly in vscode, I can see the jars in the Dependency view, but then the types can't be resolved. Also those resolution problems don't show until a file is opened, they should appear as soon as the project builds in the background. I'll keep looking. |
@jeusdi There are two javax.ws.rs.core.Application classes in your project.
|
Facing same issues in gradle project, figured out that after deletion of bin/ folder compile issue is gone. |
I have the same issue, but only when a module-info.java file is present. If I remove it, no errors are shown in vscode. |
@wtsiamruk @tmh2211 could you attach a project example? |
@snjeza I can when I come home tomorrow. It happens with the default project from gradle: |
most likely this is caused by Gradle/Buildship not adding the test flag to the test source folder in .classpath. You should have something like: <classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
</attributes>
</classpathentry> You may need to tweak your build.gradle file so that it generates that flag automatically. |
and a partial workaround (for sources) in build.gradle : eclipse/buildship#827 (comment) |
For me everything had to do with the file .setttings/org.eclipse.buildship.core.prefs. Remove everything but the following two lines from it.
Then run the 'update project configuration' by pressing Shift+Alt+U while having your build.gradle open in the editor. |
same issue, i got dependency in classpath, but vscode in java file says "The import net cannot be resolved Java(268435846)". .\gradlew build, works. |
Facing the same issue, is there any known workarounds that I could try ? |
@Shivakishore14 could you provide a project example? |
Worked for me with Java15 big thanks to user - HoldYourWaffle |
I had the same issue and this solved the issue. If the files are already in the correct directory, press F1 and type in "Clean the Java Language Server Workspace" |
I just tried the sample project with the newest extension (1.4.0) and found this issue has been solved. As @IndikaMaligaspe said, for those you had open this workspace before, you can clean the java language server workspace and reload VS Code, it will work. |
Another example of this issue is the flink training repo: https://github.com/apache/flink-training/ |
@RLashofRegas You can try the following patch:
|
@snjeza Thanks for the quick response. That worked, thanks! |
For me, issue got resolved after cleaning the Java Language Server Workspace in Vscodium. |
Same for me, but this doesn't seem like a proper fix. I'm developing a large spring boot application and cleaning the Java Language Server Workspace takes about 2 minutes, 5-10 minutes on older machines. Has anyone found out why exactly this happens? Because for me it seems quite random when I encounter these errors. |
I've pushed related code on https://github.com/jeusdi/gradle-vscode.git
gradle compileJava
runs correctly, but vscode-java is getting me compilation errors.Environment
Steps To Reproduce
[attach a sample project reproducing the error]
attach logs
Current Result
Expected Result
gradle command ends succesfully:
Additional Informations
The text was updated successfully, but these errors were encountered: