Fix unit test execution error issue#47
Open
runchen0919 wants to merge 2 commits intoeclipseguru:mainfrom
Open
Conversation
guw
reviewed
Jan 2, 2026
.../src/com/salesforce/bazel/eclipse/core/classpath/BazelClasspathContainerRuntimeResolver.java
Show resolved
Hide resolved
Merged
guw
reviewed
Jan 5, 2026
| if (isNewProject) { | ||
| currentDepth++; | ||
| } | ||
| return isNewProject; |
Author
There was a problem hiding this comment.
sure, #52 has been merged and I will rebase the main branch.
guw
reviewed
Jan 5, 2026
| // This ensures that Eclipse-compiled classes (including test classes) are available at runtime | ||
| addProjectOutputFolders(project, resolutionContext); | ||
|
|
||
| // Note: Test framework dependencies (like JUnit) are now pre-cached in the container during |
Member
There was a problem hiding this comment.
This is weird. Why wouldn't they come from regular Bazel dependencies?
Author
There was a problem hiding this comment.
- Eclipse compiles to its own output folders:
- Main classes → eclipse-bin
- Test classes → eclipse-testbin
- Bazel compiles to different locations:
- Bazel outputs go to bazel-bin, bazel-out, etc.
- The runtime classpath is being built from Bazel's dependency graph (via the saved container), but this graph only knows about:
- JAR dependencies
- Other project dependencies
- Bazel-compiled outputs
- The project's OWN Eclipse-compiled classes are NOT in Bazel's dependency graph because:
- You don't declare a dependency on yourself in Bazel
- Eclipse's incremental compilation outputs are IDE-specific, not part of Bazel's build model
guw
reviewed
Jan 5, 2026
|
|
||
| // Add the project's own output folders to the runtime classpath | ||
| // This ensures that Eclipse-compiled classes (including test classes) are available at runtime | ||
| addProjectOutputFolders(project, resolutionContext); |
Member
There was a problem hiding this comment.
org.eclipse.jdt.launching.JavaRuntime.resolveRuntimeClasspathEntry(IRuntimeClasspathEntry, IJavaProject, boolean) would add the output folders alread. I don't think we should be doing this.
I wonder if the error reported in #46 is caused by missing test dependencies.
Author
There was a problem hiding this comment.
When I comment out this line of code, I encounter the following problem.
java.lang.NoClassDefFoundError: com/projectName/demo_app/DemoServiceHandler
at com.projectName.demo_app.DemoServiceHandlerTest.testBarCopiesFieldsToResponses([DemoServiceHandlerTest.java:22](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html))
Caused by: java.lang.ClassNotFoundException: com.projectName.demo_app.DemoServiceHandler
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass([BuiltinClassLoader.java:581](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html))
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass([ClassLoaders.java:178](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html))
at java.base/java.lang.ClassLoader.loadClass([ClassLoader.java:527](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html))
... 27 more
Fixed bug where currentDepth was unconditionally incremented in beginResolvingProject(), causing potential counter mismatches. Now only increments when project is actually added to processedProjects. Removed redundant cycle checks in calling code since the method now handles duplicate projects correctly on its own.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #46
cc: @guw