protected void startModuleElement()

in src/main/java/org/apache/maven/plugins/ear/AbstractEarModule.java [363:386]


    protected void startModuleElement( XMLWriter writer, Boolean generateId )
    {
        writer.startElement( MODULE_ELEMENT );

        // If a moduleId is specified, always include it
        if ( getModuleId() != null )
        {
            writer.addAttribute( "id", getModuleId() );
        }
        else if ( generateId )
        {
            // No module id was specified but one should be generated.
            // FIXME: Should we use the mapping using outputFileNameMapping instead
            // of doing this on our own?
            Artifact theArtifact = getArtifact();
            String generatedId = theArtifact.getType().toUpperCase() + "_" + theArtifact.getGroupId() + "."
                + theArtifact.getArtifactId();
            if ( null != theArtifact.getClassifier() && theArtifact.getClassifier().trim().length() > 0 )
            {
                generatedId += "-" + theArtifact.getClassifier().trim();
            }
            writer.addAttribute( "id", generatedId );
        }
    }