2

I can set window title using following code in "maven-java doc-plugin".

<configuration>
     <windowtitle>name</windowtitle>
</configuration>

but I cannot set "favicon" to my java doc

  • I am deploying some Javadoc within another web application over which I have zero control. In this other web application, favicon.ico is placed in "/img/favicon.ico". The Javadoc tries to retrieve favicon.ico from "/favicon.ico". – Montecarlo May 23 '19 at 18:52
  • @leopal it is the same question :P – Bilbo Baggins May 28 '19 at 13:29

2 Answers2

1

I saw your question and found the following is my observation.

  1. First of all, there isn't any ready-made solution in maven-javadoc-plugin which will allow you to add a custom favicon.ico in your Javadoc.

But the good thing is:
I also found out that in maven-javadoc-plugin you can modify it to use your custom doclet implementation for generating Javadocs.

Now, what is doclet (More details here)?

From the above link,

Javadoc Doclets You can customize the content and format of the Javadoc tool's output by usingdoclets. The Javadoc tool has a default "built-in"doclet, called the standarddoclet, that generates HTML-formatted API documentation. You can modify or subclass the standarddoclet, or write your owndocletto generate HTML, XML, MIF, RTF or whatever output format you'd like

So basically you can customize what your Javadoc can generate, you can use more information on customizing the doclet in below mentioned links.

  1. Information about which class to modify to generate custom Javadocs.
  2. Once you customize the doclet, then you can use it in your maven-javadoc-plugin as mentioned here.

I hope this helps.

Bilbo Baggins
  • 2,899
  • 10
  • 52
  • 77
0

In my experience, creating your own doclet can be very challenging, and is not well supported by the JDK in Java 8 and later.

If you are using Maven, an easier way would be to use the Google Maven Replacer plugin to modify the output after it is generated, as in the following example:

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.3.1</version>
                <configuration>
                    <show>private</show>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>javadoc</goal>
                        </goals>
                        <phase>install</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>maven-replacer-plugin</artifactId>
                <version>1.4.1</version>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>target/site/apidocs/**/*.html</include>
                            </includes>
                            <regex>false</regex>
                            <replacements>
                                <replacement>
                                    <token><![CDATA[<head>]]></token>
                                    <value>
<![CDATA[
<head>
    <link rel="shortcut icon" href="img/favicon/icon.png">
]]>
                                    </value>
                                </replacement>
                            </replacements>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
Templar
  • 5,067
  • 7
  • 34
  • 39