<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->


<faqs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://maven.apache.org/FML/1.0.1"
  xsi:schemaLocation="http://maven.apache.org/FML/1.0.1 http://maven.apache.org/xsd/fml-1.0.1.xsd"
  id="FAQ" title="Frequently Asked Questions">
  <part id="General">
    <faq id="What are the Javadoc options supported by the Maven Javadoc Plugin">
      <question>What are the Javadoc options supported by the Maven Javadoc Plugin?</question>
      <answer>
        <p>
          All options provided by Oracle on the Javadoc homepages are wrapped in the Maven Javadoc Plugin. This
          plugin supports Javadoc 1.4, 1.5 and 6.0 options. Refer to the
          <a href="./apidocs/org/apache/maven/plugins/javadoc/package-summary.html">Javadoc Package Summary</a>
          for more information and to the <a href="./javadoc-mojo.html">Javadoc Plugin Documentation</a>.
        </p>
      </answer>
    </faq>
    <faq id="Where in the pom.xml do I configure the Javadoc Plugin">
      <question>Where in the pom.xml do I configure the Javadoc Plugin?</question>
      <answer>
        <p>
          Like all other reporting plugins, the Javadoc Plugin goes in the <i>&lt;reporting/&gt;</i> section
          of your pom.xml. In this case, you will need to call <code>mvn site</code> to run reports.
        </p>
        <p>
          You could also configure it in the <i>&lt;plugins/&gt;</i> or <i>&lt;pluginsManagement/&gt;</i> in
          <i>&lt;build/&gt;</i> tag of your pom.xml. In this case, you will need to call
          <code>mvn javadoc:javadoc</code> to run the main report.
        </p>
        <p>
          <b>IMPORTANT NOTE</b>: using <i>&lt;reporting/&gt;</i> or <i>&lt;build/&gt;</i> elements have not the same
          behavior, refer to
          <a href="http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_reporting_Tag_VS_build_Tag">Using the &lt;reporting/&gt; Tag VS &lt;build/&gt; Tag</a>
          part for more information.
        </p>
      </answer>
    </faq>
    <faq id="Where do I put javadoc resources like HTML files or images">
      <question>Where do I put Javadoc resources like HTML files or images?</question>
      <answer>
        <p>
          All javadoc resources like HTML files, images could be put in the
          <i>${basedir}/src/main/javadoc</i> directory.
        </p>
        <p>
          See <a href="examples/javadoc-resources.html">Using Javadoc Resources</a> for more information.
        </p>
      </answer>
    </faq>
    <faq id="How to know exactly the Javadoc command line">
      <question>How to know exactly the Javadoc command line?</question>
      <answer>
        <p>
          The Javadoc Plugin calls the Javadoc tool with
          <a href="https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#argumentfiles">argument files</a>,
          i.e. files called 'options', 'packages' and 'argfile' (or 'files' with Jdk &lt; 1.4):
          <source><![CDATA[
javadoc.exe(or .sh) @options @packages | @argfile]]></source>
        </p>
        <p>
          These argument files are generated at runtime depending the Javadoc Plugin configuration and are deleted
          when the Javadoc Plugin ended.
        </p>
        <p>
          To preserve them, just add &lt;debug&gt;true&lt;/debug&gt; in your Javadoc Plugin configuration or just call
          <code>mvn javadoc:javadoc -Ddebug=true</code> or <code>mvn javadoc:javadoc -X</code>.
          In this case, an additional script file (javadoc.bat (or .sh) will be created in the <code>apidocs</code>
          directory.
        </p>
      </answer>
    </faq>
    <faq id="How to add additional Javadoc parameters">
      <question>How to add additional Javadoc parameters?</question>
      <answer>
        <p>
          You could need to add more Javadoc parameters to be process by the Javadoc Tool (i.e. for doclet).
        </p>
        <p>
          For this, you should use the <i>&lt;additionalOptions/&gt;</i> parameter in your Javadoc Plugin configuration.
        </p>
      </answer>
    </faq>
    <faq id="How to add additional Javadoc options">
      <question>How to add additional Javadoc options?</question>
      <answer>
        <p>
          You could need to add more J options (i.e. runtime system java options that runs Javadoc tool like -J-Xss)
          to be processed by the Javadoc Tool. For this, you should use the <i>&lt;additionalJOption/&gt;</i> parameter
          in your Javadoc Plugin configuration.
        </p>
        <p>
          The Javadoc Plugin calls the Javadoc tool with J options, e.g.:
          <source><![CDATA[
${project.reporting.outputDirectory}/apidocs/javadoc.exe(or .sh) \
    -J-Xss128m \
    @options \
    @packages | @argfile]]></source>
        </p>
      </answer>
    </faq>
    <faq id="How to increase Javadoc heap size">
      <question>How to increase Javadoc heap size?</question>
      <answer>
        <p>
          If you need to increase the Javadoc heap size, you should use the <i>&lt;minmemory/&gt;</i> and
          <i>&lt;maxmemory/&gt;</i> parameters in your Javadoc Plugin configuration. For instance:
          <source><![CDATA[
<project>
  ...
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          ...
          <minmemory>128m</minmemory>
          <maxmemory>1g</maxmemory>
          ...
        </configuration>
      </plugin>
    </plugins>
    ...
  </reporting>
  ...
</project>]]></source>
        </p>
        <p>
          <b>Note:</b> The memory unit depends on the JVM used. The units supported could be: <code>k</code>,
          <code>kb</code>, <code>m</code>, <code>mb</code>, <code>g</code>, <code>gb</code>, <code>t</code>,
          <code>tb</code>. If no unit specified, the default unit is <code>m</code>.
        </p>
      </answer>
    </faq>
    <faq id="How to add proxy support">
      <question>How to add proxy support?</question>
      <answer>
        <p>
          To specify a proxy in the Javadoc tool, you need to configure an active proxy in your
          <i>${user.home}/.m2/settings.xml</i>, similar to:
          <source><![CDATA[
<settings>
  ...
  <proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.somewhere.com</host>
      <port>3128</port>
      <username>foo</username>
      <password>bar</password>
      <nonProxyHosts>java.sun.com|*.somewhere.com</nonProxyHosts>
    </proxy>
  </proxies>
  ...
</settings>
]]></source>
          With this, the Javadoc tool will be called with networking J options, e.g.:
          <source><![CDATA[
${project.reporting.outputDirectory}/apidocs/javadoc.exe(or .sh) \
    -J-Dhttp.proxySet=true \
    -J-Dhttp.proxyHost=proxy.somewhere.com \
    -J-Dhttp.proxyPort=3128 \
    -J-Dhttp.nonProxyHosts="java.sun.com|*.somewhere.com" \
    -J-Dhttp.proxyUser="foo" \
    -J-Dhttp.proxyPassword="bar" \
    @options \
    @packages | @argfile]]></source>
        </p>
        <p>
          <b>Note</b>: If your proxy needs more JVM
          <a href="https://docs.oracle.com/javase/7/docs/technotes/guides/net/properties.html">networking properties</a>
          (like NTLM), you could always add JVM options using the <i>&lt;additionalJOption/&gt;</i> parameter
          in your Javadoc Plugin configuration, e.g.:
          <source><![CDATA[
<configuration>
  <additionalJOption>-J-Dhttp.auth.ntlm.domain=MYDOMAIN</additionalJOption>
  ...
</configuration>]]></source>
        </p>
      </answer>
    </faq>
    <faq id="How to have less output">
      <question>How to have less output?</question>
      <answer>
        <p>
          Just set the <i>&lt;quiet/&gt;</i> parameter to <i>true</i> in your Javadoc Plugin configuration.
        </p>
      </answer>
    </faq>
    <faq id="How to remove test Javadocs report">
      <question>How to remove test Javadocs report?</question>
      <answer>
        <p>
          You need to configure the <i>&lt;reportSets/&gt;</i> parameter. Read the
          <a href="examples/selective-javadocs-report.html">Selective Javadocs Reports</a> part for more information.
        </p>
      </answer>
    </faq>
    <faq id="How to deploy Javadoc jar file">
      <question>How to deploy Javadoc jar file?</question>
      <answer>
        <p>
          Basically, you need to call <i>mvn clean javadoc:jar deploy</i>. If you want to include the javadoc jar
          in a release process, you need to attach it in the release profile, for instance:
          <source><![CDATA[
<project>
  ...
  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    ...
  </profiles>
  ...
</project>]]></source>
        </p>
        <p>
          To deploy the Javadoc jar on a given Maven repository, you could call:
          <source><![CDATA[
mvn deploy:deploy-file \
    -DgroupId=<group-id> \
    -DartifactId=<artifact-id> \
    -Dversion=<version> \
    -Dfile=<path-to-file> \
    -Dpackaging=jar \
    -DrepositoryId=<repository-id> \
    -Durl=dav:http://www.myrepository.com/m2 \
    -Dclassifier=javadoc]]></source>
        </p>
      </answer>
    </faq>
    <faq id="How to include additional source code directories in aggregate mode">
      <question>How to include additional source code directories in aggregate mode?</question>
      <answer>
        <p>
          If you use the Javadoc report in the aggregate mode, i.e. using the <code>aggregate</code> parameter, and if the
          Javadoc report does not include additional source code directories defined using the
          <a href="https://www.mojohaus.org/build-helper-maven-plugin/add-source-mojo.html">build-helper:add-source</a> goal,
          you need to use the <code>javadoc:aggregate</code> goal instead of <code>javadoc:javadoc</code> goal. Read the
          <a href="examples/aggregate.html">Aggregating Javadocs for Multi-Projects</a> part for more information.
        </p>
      </answer>
    </faq>
    <faq id="How to use links option in Standard Doclet">
      <question>How to use <code>&lt;links/&gt;</code> option in Standard Doclet?</question>
      <answer>
        <p>
          You need to configure the <i><a href="./javadoc-mojo.html#links">&lt;links/&gt;</a></i> parameter. Also, you
          should correctly write references in your Javadoc. That is,
        </p>
        <ul>
          <li><code>@see MyMojo</code> or <code>{@link MyMojo}</code> will <strong>NOT work</strong>.</li>
          <li><code>@see com.mycompany.plugin.myplugin.MyMojo</code> or <code>{@link com.mycompany.myplugin.MyMojo}</code>
            will <strong>work</strong>.</li>
        </ul>
      </answer>
    </faq>
    <faq id="How to add cross reference link to internal-external projects">
      <question>How to add cross reference link to internal-external projects?</question>
      <answer>
        <p>
          Please refer to <a href="./examples/links-configuration.html">Links configuration page</a>.
        </p>
      </answer>
    </faq>
    <faq id="What are the values of the encoding, docencoding, and charset parameters">
      <question>What are the values of the <code>&lt;encoding/&gt;</code>, <code>&lt;docencoding/&gt;</code>, and <code>&lt;charset/&gt;</code> parameters?</question>
      <answer>
        <p>
          By default, these parameters have the following values:
        </p>
        <dl>
          <dt><code>&lt;encoding/&gt;</code></dt>
          <dd>Value of <code>${project.build.sourceEncoding}</code> property or the value of the
            <code>file.encoding</code> system property if not specified.</dd>
          <dt><code>&lt;docencoding/&gt;</code></dt>
          <dd>Value of <code>${project.reporting.outputEncoding}</code> property or <code>UTF-8</code> if not specified.</dd>
          <dt><code>&lt;charset/&gt;</code></dt>
          <dd>Value of <code>docencoding</code> parameter if not specified.</dd>
        </dl>
      </answer>
    </faq>
    <faq id="Why do I get errors when using links under Java 8">
      <question>Why do I get errors when using links under Java 8?</question>
      <answer>
        <p>
          Due to <a href="https://bugs.openjdk.java.net/browse/JDK-8040771">a bug in JDK 8</a>
          you need at least Java 8u20 for this to work. See
          <a href="https://issues.apache.org/jira/browse/MJAVADOC-393">MJAVADOC-393</a>
          for more info.
        </p>
      </answer>
    </faq>
  </part>
</faqs>
