Search code examples
mavenjavadoc

Killing Javadoc warnings for specific tags


Is there an easy way / option of preventing javadoc warnings when building with Maven? We use the soyatec uml plugin for eclipse and it inserts special tags which make our builds throw lots of annoying warnings; I've looked around including on the soyatec site and have come up empty.

@uml.property is an unknown tag

Solution

  • The only answer I could find to this is by Configuring Custom Javadoc Tags.

    An example could be like this:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.8.1</version>
                <configuration>
                    <tags>
                        <tag>
                            <name>uml.property</name>
                            <!-- The value X makes javadoc ignoring the tag -->
                            <placement>X</placement>
                        </tag>
                        <tag>
                            <name>some.other.property</name>
                            <placement>X</placement>
                        </tag>
                        <tag>
                            <name>some.third.property</name>
                            <placement>X</placement>
                        </tag>
                    </tags>
                </configuration>
            </plugin>
        </plugins>
    </build>
    

    When running you will see this in the output:

    mvn javadoc:javadoc
    
    <lots of output>
    Note: Custom tags that were not seen:  @uml.property
    <maybe more output>
    

    And you can disable non-error and non-warning messages by using this command:

    mvn javadoc:javadoc -Dquiet
    

    It might be a hard job to define all these tags but once done you will no longer see the warnings.

    And you should probably define these custom tags in a parent pom that everyone can use to benefit all the work.