Search code examples
javaintellij-ideajavadoc

Javadoc not auto-generating in IntelliJ IDEA


I'm having trouble with the file templates for Java Development in IntelliJ IDEA. I created an includes file to be parsed out and create Javadoc Comments from it.

File > Settings > Editor > File and Code Templates > Includes Tab

I added these variables to my File Header:

@name ${NAME}
@author #set( $Company = "Avaruus Studios" )
@date ${DATE}

File and Code Templates - Includes Tab

I then added the parse directive to the File Template:

#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
public class ${NAME} {
}

File and Code Templates - Files Tab

When I add a new Java Class, the Javadoc Header Comments that are generated show up as errors:

New Java Class Error

How can I fix this template so that they are generated correctly?


Solution

  • Javadoc needs to be inside comment brackets for java, so try changing your template file to:

    Edit:

    #set( $Company = "Avaruus Studios" )
    /**
    * @name ${NAME}
    * @author ${Company}
    * @date ${DATE}
    */