private void writeDescription()

in src/main/java/org/apache/maven/plugin/doap/DoapMojo.java [790:826]


    private void writeDescription(XMLWriter writer, MavenProject project) {
        boolean addComment = false;
        String description = DoapUtil.interpolate(doapOptions.getDescription(), project, settings);
        if (description == null || description.isEmpty()) {
            messages.addMessage(
                    new String[] {"doapOptions", "description"}, null, UserMessages.REQUIRED_BY_ASF_OR_RECOMMENDED);
        } else {
            DoapUtil.writeComment(writer, "Plain text description of a project, of 2-4 sentences in length.");
            addComment = true;
            DoapUtil.writeElement(writer, doapOptions.getXmlnsPrefix(), "description", description, lang);
        }

        String comment = "Short plain text description of a project.";
        String shortdesc = DoapUtil.interpolate(doapOptions.getShortdesc(), project, settings);
        if (shortdesc == null || shortdesc.isEmpty()) {
            messages.addMessage(
                    new String[] {"doapOptions", "shortdesc"}, null, UserMessages.REQUIRED_BY_ASF_OR_RECOMMENDED);
            return;
        }
        if (description.equals(shortdesc)) {
            // try to get the first 10 words of the description
            String sentence = StringUtils.split(shortdesc, ".")[0];
            if (StringUtils.split(sentence, " ").length > 10) {
                messages.addMessage(new String[] {"doapOptions", "shortdesc"}, null, UserMessages.SHORT_DESC_TOO_LONG);
                return;
            }
            if (!addComment) {
                DoapUtil.writeComment(writer, comment);
            }
            DoapUtil.writeElement(writer, doapOptions.getXmlnsPrefix(), "shortdesc", sentence, lang);
            return;
        }
        if (!addComment) {
            DoapUtil.writeComment(writer, comment);
        }
        DoapUtil.writeElement(writer, doapOptions.getXmlnsPrefix(), "shortdesc", shortdesc, lang);
    }