Maven生成Javadoc报错:未知标签问题求助
Hey there, let's get that Javadoc build error sorted out for you! The problem you're facing when running mvn javadoc:javadoc javadoc:aggregate is caused by a tiny typo in your Javadoc comment.
错误根源
Javadoc has strict rules for its standard tags, and you used @throw instead of the correct @throws (note the trailing "s"). The tool doesn't recognize @throw as a valid tag, hence the "unknown tag" error.
修正后的代码
Here's the fixed version of your method, including a small logic fix in the error message (it currently says "b must be equal to 0" which contradicts the check for b == 0):
/** * Divide two integers * @param a the dividend integer * @param b the divisor integer * @return the result of a divided by b, if b is not zero * @throws IllegalArgumentException if b is equal to 0 */ public static int division(final int a, final int b) { if (b == 0) { throw new IllegalArgumentException("b must NOT be equal to 0"); } return a / b; }
验证修复
Once you update the Javadoc and fix that error message, re-run your Maven command:
mvn javadoc:javadoc javadoc:aggregate
The "unknown tag" error should no longer appear, and your Javadoc should generate successfully.
内容的提问来源于stack exchange,提问作者Leon

