Maven javadoc + custom doclet

2019-08-07 03:29发布

问题:

How can i specify the doclect artifact when calling mvn from command line

mvn clean install javadoc:javadoc -Ddoclet=my.Doclet -DdocletArtifact=????

回答1:

You should add something like this to your pom.xml:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <configuration>
      <doclet>my.doclet</doclet>
      <docletArtifact>
        <groupId>my.artifact.group</groupId>
        <artifactId>my.artifact.id</artifactId>
        <version>my.artifact.version</version>
      </docletArtifact>
    </configuration>
  </plugin>

This is also documented in detail in section Using Alternate Doclet of the Apache Maven Javadoc Plugin documentation.

You cannot simply specify these parameters from the command line, but using a Build Profile may help you selecting the configuration you want to have.