private void parsePomFile()

in doc-architect/doc-architect-core/src/main/java/com/docarchitect/core/scanner/impl/java/MavenDependencyScanner.java [166:232]


    private void parsePomFile(Path pomFile, List<Dependency> dependencies, List<Component> components) throws IOException {
        String content = readFileContent(pomFile);

        // Parse POM using Jackson
        @SuppressWarnings("unchecked")
        Map<String, Object> pom = xmlMapper.readValue(content, Map.class);

        // Extract project coordinates
        String groupId = extractText(pom, KEY_GROUP_ID);
        String artifactId = extractText(pom, KEY_ARTIFACT_ID);
        String version = extractText(pom, KEY_VERSION);
        String packaging = extractText(pom, KEY_PACKAGING, DEFAULT_PACKAGING);

        // Handle parent POM inheritance
        if (groupId == null || version == null) {
            @SuppressWarnings("unchecked")
            Map<String, Object> parent = (Map<String, Object>) pom.get(KEY_PARENT);
            if (parent != null) {
                if (groupId == null) {
                    groupId = extractText(parent, "groupId");
                }
                if (version == null) {
                    version = extractText(parent, "version");
                }
            }
        }

        // Build properties map for placeholder resolution
        Map<String, String> properties = new HashMap<>();
        if (groupId != null) properties.put(PROPERTY_PROJECT_GROUP_ID, groupId);
        if (artifactId != null) properties.put(PROPERTY_PROJECT_ARTIFACT_ID, artifactId);
        if (version != null) properties.put(PROPERTY_PROJECT_VERSION, version);

        // Extract custom properties
        Object propertiesSectionObj = pom.get(KEY_PROPERTIES);
        if (propertiesSectionObj instanceof Map) {
            @SuppressWarnings("unchecked")
            Map<String, Object> propertiesSection = (Map<String, Object>) propertiesSectionObj;
            propertiesSection.forEach((key, value) ->
                properties.put(key, String.valueOf(value))
            );
        } else if (propertiesSectionObj != null) {
            log.debug("Unexpected properties type in POM {}: {}", pomFile, propertiesSectionObj.getClass().getName());
        }

        // Create component for this Maven project
        if (artifactId != null) {
            Component component = new Component(
                IdGenerator.generate("maven", groupId, artifactId),
                artifactId,
                "jar".equals(packaging) ? ComponentType.LIBRARY : ComponentType.SERVICE,
                COMPONENT_DESCRIPTION_PREFIX + (groupId != null ? groupId + ":" : "") + artifactId,
                COMPONENT_TECH,
                pomFile.getParent().toString(),
                Map.of(
                    "groupId", Objects.toString(groupId, ""),
                    "version", Objects.toString(version, ""),
                    "packaging", packaging
                )
            );
            components.add(component);
        }

        // Extract dependencies
        extractDependencies(pom, KEY_DEPENDENCIES, properties, dependencies);
        extractDependencies(pom, KEY_DEPENDENCY_MANAGEMENT, properties, dependencies);
    }