fix(import): give test source folders their own output directory #91
No reviewers
Labels
No labels
bug
build
enhancement
headless
P1-critical
P2-high
P3-medium
P4-low
refactoring
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ai-tools/jdt-mcp-server!91
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/84-test-output-folder"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
ProjectImporter.addSourceFolderIfExists()created every source classpathentry via
JavaCore.newSourceEntry(path)with no dedicated output location.src/test/javatherefore compiled into the same output assrc/main/java(
target/classesfor Maven,build/classes/java/mainfor Gradle). Asubsequent
mvn packagewithoutcleanpacked the test classes into themodule jar, and dependent modules then saw "Unresolved compilation
problems" once jdt-mcp was connected to the workspace (arknet test: 17
extra classes in
arknet-shared-kernel, 56 inarknet-mcp).Fix
Test source folders (
src/test/java,src/test/resources,src/test/kotlin) now get an explicit output location —target/test-classesfor Maven,build/classes/java/testfor Gradle —mirroring m2e's behaviour. Main sources keep using the project's default
output (unchanged).
ExecutionToolsalready readsgetOutputLocation()per source entry to build the runtime classpath, so no change was needed
there.
Plain (no build tool) projects are left untouched — there's no established
test-output convention to follow without a build file, and the issue's
expectation (m2e/Gradle parity) doesn't apply to them.
Also removed the now-obsolete "known limitation" row for #84 from
README.md.
#46 (Maven test-scope dependencies)
Verified as already fixed by commit
8084c7d(
-DincludeScope=compile→-DincludeScope=testinaddMavenDependencies()). Reimportingfixture-coreproduces zeroorg.junitcompile errors.Closes #84
Refs #46
Verification
mvn -pl org.naturzukunft.jdt.mcp -am compile— cleanmvn clean package— BUILD SUCCESStests/smoke-test.shagainst the built product: 9/9 passedtests/lifecycle-test.shagainst the built product: 5/5 passedtests/fixtures/fixture-parent(copied to a temp dir) viastdio against the built product. Generated
.classpathforfixture-core:jdt_get_compilation_errors(fixture-core)→ 0 errors, 1 unrelatedpre-existing warning (unused private method). No
org.juniterrors.🤖 Generated with Claude Code
https://claude.ai/code/session_016tHV1dzUTdTwMLgx6yotVd