fix: detect <java.version> in pom.xml — Spring Boot standard was ignored#15
Open
bipinhcs11 wants to merge 1 commit into
Open
fix: detect <java.version> in pom.xml — Spring Boot standard was ignored#15bipinhcs11 wants to merge 1 commit into
bipinhcs11 wants to merge 1 commit into
Conversation
Spring Boot projects conventionally declare their Java version as:
<properties>
<java.version>17</java.version>
</properties>
The previous regex in _detect_java_version only matched the Maven
Compiler plugin properties (maven.compiler.source/target/release),
so every Spring Boot repo using the <java.version> convention got
"Unknown" for java_version in the crawl index and doctor report.
Fix: extend the regex with java\.version as a leading alternative.
The maven.compiler.* and bare source/target/release paths are
unchanged.
Adds TestDetectJavaVersion (9 tests) to test_crawler.py covering the
regression case, both existing Maven patterns, old-style 1.8 → 8
normalisation, no-pom and no-version-info fallbacks, and Gradle.
The test_doctor.py _tiny_spring_boot_repo() fixture already used a
pom.xml with <java.version>17</java.version> but never asserted the
value — this fix makes that fixture exercise live detection.
Other finding (not in this PR): _extract_properties_prefixes computes
a `top` variable that is never used (dead code, one line); worth a
separate chore PR.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
https://claude.ai/code/session_018RA51ZizjGN5R37jqqxZzi
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.
What
One-line regex fix in
_detect_java_version+ 9 new tests.Why
Spring Boot projects standardly declare their Java version as:
_detect_java_versiononly matchedmaven.compiler.source,maven.compiler.target,maven.compiler.release(and their baresource/target/releaseforms). The<java.version>property — used by the Spring Boot starter POM and recommended in the Spring Boot docs — was silently ignored, causing every such repo to reportjava_version: "Unknown"in both the crawl index and thedoctoroutput.The bug was hiding in plain sight:
test_doctor.py's_tiny_spring_boot_repo()fixture already wrote apom.xmlwith<java.version>17</java.version>but the test never asserted the java_version was detected.Changes
tools/skill_generator/crawler.pyjava\.versionas a leading alternative in the_detect_java_versionpom.xml regex (1 line)tests/test_crawler.pyTestDetectJavaVersion(9 tests); import_detect_java_versionWhat's tested
test_spring_boot_java_version_property<java.version>17now returns"17"test_maven_compiler_sourcemaven.compiler.sourcepath still workstest_maven_compiler_release<release>path still workstest_old_java_1_8_normalized1.8→"8"via_normalize_java_version(maven path)test_spring_boot_java_version_1_8_normalized1.8→"8"via_normalize_java_version(java.version path)test_no_pom_returns_unknownpom.xml→"Unknown"test_pom_with_no_version_info_returns_unknownpom.xmlpresent but no version element →"Unknown"test_gradle_jvm_targetjvmTargetpath still workstest_gradle_source_compatibilitysourceCompatibility = JavaVersion.VERSION_17path still worksSuite: 172 → 181 tests, all green.
Follow-ups noted (not in this PR)
_extract_properties_prefixesincrawler.pycomputes atopvariable (line after thefor seploop) that is assigned but never read — dead code, worth a separatechorePR.test_doctor.pyfixture now implicitly exercises<java.version>detection; adding an explicit assertion forstack["java_version"] == "17"would make the intent clear — could be a one-liner follow-up.https://claude.ai/code/session_018RA51ZizjGN5R37jqqxZzi
Generated by Claude Code