Release Of A Maven-Plugin to Maven Central Fails With “error: unknown tag: goal”
error: unknown tag: goal
Releasing a maven-plugin via Maven Central does not work, if you have switched to Java 8.
This happens, because hidden in the oss-parent
, that you have to configure as parent
of your project to be able to release it via Sonatype, the maven-javadoc-plugin
is configured for you.
And the version of javadoc
, that is shipped with Java 8, by default checks the syntax of the comments and fails, if anything unexpected is seen.
Unfortunatly, the special javadoc-tag’s, like @goal
or @phase
, that are needed to configure the maven-plugin, are unexpected for javadoc.
Solution 1: Turn Of The Linting Again
As described elswehere, you can easily turn of the linting in the plugins-section of your pom.xml
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
Solution 2: Tell javadoc About The Unknown Tags
Another not so well known approach, that I found in a fix for an issue of some project, is, to add the unknown tag’s in the configuration of the maven-javadoc-plugin
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<tags>
<tag>
<name>goal</name>
<placement>a</placement>
<head>Goal:</head>
</tag>
<tag>
<name>phase</name>
<placement>a</placement>
<head>Phase:</head>
</tag>
<tag>
<name>threadSafe</name>
<placement>a</placement>
<head>Thread Safe:</head>
</tag>
<tag>
<name>requiresDependencyResolution</name>
<placement>a</placement>
<head>Requires Dependency Resolution:</head>
</tag>
<tag>
<name>requiresProject</name>
<placement>a</placement>
<head>Requires Project:</head>
</tag>
</tags>
</configuration>
</plugin>
Funded by the Europian Union
This article was published in the course of a resarch-project, that is funded by the European Union and the federal state Northrhine-Wetphalia.
Leave a Reply