簡體   English   中英

將 favicon 設置為 maven-javadoc-plugin 生成的 javadoc 文件

[英]set favicon to maven-javadoc-plugin generated javadoc file

我可以在“ maven-java doc-plugin ”中使用以下代碼設置窗口標題。

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

但我無法將“favicon”設置為我的 Java 文檔

我看到了你的問題,發現以下是我的觀察。

  1. 首先, maven-javadoc-plugin沒有任何現成的解決方案可以讓您在 Javadoc 中添加自定義 favicon.ico。

但好處是:
我還發現在maven-javadoc-plugin您可以修改它以使用您的自定義doclet實現來生成 Javadoc。

現在,什么是doclet這里有更多詳細信息)?

從上面的鏈接,

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

所以基本上你可以自定義你的 Javadoc 可以生成的內容,你可以在下面提到的鏈接中使用更多關於自定義 doclet 的信息。

  1. 信息關於哪一類修改生成自定義的Javadoc。
  2. 一旦你自定義的doclet,那么您可以在您使用maven-javadoc-plugin提到這里

我希望這有幫助。

根據我的經驗,創建自己的 doclet 可能非常具有挑戰性,並且在 Java 8 及更高版本中不受 JDK 的良好支持。

如果您使用 Maven,更簡單的方法是使用Google Maven Replacer插件在生成后修改輸出,如下例所示:

        <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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM