之前一直使用eclipse 自帶的 export 的功能導出javadoc,功能自己還行,可是配置好了以後,要點擊4次 next,不利於集成生成 css
maven 也能夠生成javadoc,隨着mvn install ,配置 html
Xml代碼
- <!-- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.7</version>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <inherited>true</inherited>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
可是一來 原本不想生成javadoc的時候,mvn install 會比較慢 java
二來不能個性化配置 node
最終我單獨 ant 裏面配置 輸出javadoc,在這個過程當中,弄明白每一個參數的含義仍是有意義的 ,首先咱們來看效果 apache
直接上個人build.xml api
Xml代碼
- <project name="feilong-core" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
- <description>feilong-core</description>
- <property file="${basedir}/build.properties" />
-
- <property file="E:/DataCommon/java/Taglib/Apache Ant/config/build-feilong.properties" />
- <import file="${path.config}/build-config-common-nested.xml" />
- <import file="${path.config}/build-feilong-nested.xml" />
-
- <!--因爲使用的是maven 架構項目, 下面javadoc 須要引用 classpath -->
- <artifact:pom id="feilongMaven" file="pom.xml" />
- <artifact:dependencies filesetId="feilong.maven.dependencies.fileset" pathid="feilong.maven.dependencies.runtime" useScope="runtime">
- <pom refid="feilongMaven" />
- </artifact:dependencies>
-
- <artifact:dependencies pathid="feilong.maven.dependencies.system" scopes="system">
- <pom refid="feilongMaven" />
- </artifact:dependencies>
-
- <artifact:dependencies pathid="feilong.maven.dependencies.all">
- <pom refid="feilongMaven" />
- </artifact:dependencies>
-
- <!--javadoc -->
- <target name="javadoc">
- <!-- Destination directory(輸出文件的目的文件夾) -->
- <property name="destdir" value="E:\javadoc\feilong-core" />
-
- <property name="source" value="1.6" />
-
- <!-- 指定使用什麼樣式 -->
- <property name="stylesheetfile" value="${basedir}/${ant.project.name}-javadoc.css" />
- <!-- 配置預覽頁面 -->
- <property name="overview" value="src/main/java/overview.html" />
-
- <!-- 這個參數能夠用來配置幫助 -->
- <!--<property name="helpfile" value="src/main/java/overview.html" /> -->
-
- <!-- 瀏覽器窗口標題文件(文本) -->
- <property name="windowtitle" value="feilong-core 1.0 API" />
- <property name="additionalparam" value="-encoding UTF-8 -charset UTF-8" />
-
- <!-- Locale to be used -->
- <property name="locale" value="en_US" />
- <!-- Source file encoding name -->
- <property name="encoding" value="utf-8" />
- <property name="docencoding" value="utf-8" />
- <property name="charset" value="utf-8" />
-
- <!-- 包含 @author paragraphs -->
- <property name="author" value="true" />
- <!-- 包含 @version paragraphs -->
- <property name="version" value="true" />
-
- <property name="noindex" value="false" />
- <property name="nonavbar" value="false" />
- <property name="notree" value="false" />
- <property name="nodeprecatedlist" value="false" />
- <property name="nodeprecated" value="false" />
-
- <!-- Access mode: one of public, protected, package, or private -->
- <property name="access" value="public" />
- <!-- Create class and package usage pages -->
- <property name="use" value="true" />
-
- <property name="verbose" value="true" />
- <!-- 分割索引成單獨的文件 若是是true,則生成index-files文件夾,裏面存放單獨的索引文件 -->
- <property name="splitindex" value="true" />
-
- <!-- 保證生成的javadoc 是最新的 -->
- <mkdir dir="${destdir}" />
- <delete dir="${destdir}" verbose="true" />
-
- <!-- javadoc -->
- <javadoc destdir="${destdir}" windowtitle="${windowtitle}" locale="${locale}" encoding="${encoding}" docencoding="${docencoding}" charset="${charset}"
- access="${access}" version="${version}" author="${author}" use="${use}" nodeprecated="${nodeprecated}" nodeprecatedlist="${nodeprecatedlist}" noindex="${noindex}"
- nonavbar="${nonavbar}" notree="${notree}" splitindex="${splitindex}" source="${source}" overview="${overview}" verbose="${verbose}" stylesheetfile="${stylesheetfile}"
- additionalparam="${additionalparam}" classpathref="feilong.maven.dependencies.all">
- <!-- Include title for the package index(first) page (html-code) -->
- <doctitle>feilong-core 1.0 API create by 飛天奔月</doctitle>
-
- <!-- 下面三個參數,指定header footer bottom 不解釋 -->
- <header>feilong-core 1.0 API</header>
- <footer>feilong-core 1.0 API</footer>
- <bottom>
- <![CDATA[Copyright © 2009-2012 by feilong]]>
- </bottom>
-
- <fileset dir="src/main/java" defaultexcludes="yes">
- <!--這裏能夠定製 你先哪些包生成 那些包不生成javadoc -->
- <include name="com/feilong/commons/core/**" />
- </fileset>
- </javadoc>
-
- <!-- javadoc 生成完成後,打開目標目錄 -->
- <property name="_explorerPath" location="${destdir}" />
- <antcall target="Z_feilongExecExplorer" inheritall="true" />
- </target>
- </project>
下面要研究的是 怎麼用ant 生成javadoc 以後 ,直接調用相關api 生成chm 格式的文檔 瀏覽器