protected static String getStructure()

in maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReportUtil.java [188:231]


    protected static String getStructure(MavenProject project, boolean ignoreMissingSiteUrl) throws IOException {
        // @todo come from site plugin!
        // @see o.a.m.p.site.SiteStageMojo#getStructure(MavenProject project, boolean ignoreMissingSiteUrl )
        if (project.getDistributionManagement() == null) {
            String hierarchy = project.getName();

            MavenProject parent = project.getParent();
            while (parent != null) {
                hierarchy = parent.getName() + '/' + hierarchy;
                parent = parent.getParent();
            }

            return hierarchy;
        }

        Site site = project.getDistributionManagement().getSite();
        if (site == null) {
            if (!ignoreMissingSiteUrl) {
                throw new IOException("Missing site information in the distribution management "
                        + "element in the project: '" + project.getName() + "'.");
            }

            return null;
        }

        if (StringUtils.isEmpty(site.getUrl())) {
            if (!ignoreMissingSiteUrl) {
                throw new IOException("The URL in the site is missing in the project descriptor.");
            }

            return null;
        }

        Repository repository = new Repository(site.getId(), site.getUrl());
        if (StringUtils.isEmpty(repository.getBasedir())) {
            return repository.getHost();
        }

        if (repository.getBasedir().startsWith("/")) {
            return repository.getHost() + repository.getBasedir();
        }

        return repository.getHost() + '/' + repository.getBasedir();
    }