Riduidel / aadarchi

A maven archetype to generate easily projects allowing architecture description using a mix of C4, agile architecture, Asciidoc and PlantUML
https://riduidel.github.io/aadarchi/
Apache License 2.0
40 stars 12 forks source link

POM read from SCM url may not be correctly decorated #254

Closed Riduidel closed 1 year ago

Riduidel commented 1 year ago

Due to #235, a new branch was added in MavenDetailsInfererEnhancer#processModelElement(Element) :

            // If there is some kind of SCM path, and a configured SCM provider,
            // let's check if we can find some pom.xml
            var project= element.getProperties().get(ModelElementKeys.Scm.PROJECT);
            for(SCMHandler handler : scmHandler) {
                try {
                    Collection<SCMFile> pomSCMFile = handler.find(project, "/", file -> "pom.xml".equals(file.name()));
                    for(SCMFile pom : pomSCMFile) {
                        URL url = new URL(pom.url());
                        return Optional.ofNullable(readMavenProject(pom.url(), url, 
                                cache.openStreamFor(pom)));
                    }
                } catch (IOException | XmlPullParserException e) {
                    logger.log(Level.FINER, String.format("There is no pom.xml in %s, maybe it's normal", project), e);
                }
            }

This new branch works correctly, but doesn't seems to invoke the MavenDetailsInfererEnhancer#decorate(Element, MavenProject) method. Seems like this code could deserve a lightweight refactoring ...