Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Maven User
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<p>The information on this page is user-contributed. Its accuracy is not verified by the Maven team!</p> <h1>Tips and Surprises</h1> <ul> <li> <bottom> tag: If you want to include html markup, embed the text in a cdata section: e.g. <bottom><![CDATA[Copyright 2005, <a xhref=" <a href="http://www.mycompany.com">http://www.mycompany.com</a>">MyCompany, Inc.<a>]]></bottom></li> <li>The @see and @link tags are not handeld correctly (see issue report: <a href="http://jira.codehaus.org/browse/MJAVADOC-28">http://jira.codehaus.org/browse/MJAVADOC-28</a>)</li> </ul> <h1>Examples</h1> <h2>Using a different doclet</h2> <p> This example uses Sun's standard doclet:</p> <p> <plugin><br /> <groupId>org.apache.maven.plugins</groupId><br /> <artifactId>maven-javadoc-plugin</artifactId><br /> <configuration><br /> <doclet>com.sun.tools.doclets.standard.Standard</doclet --><br /> <docletPath>C:\Programm Files\Java\jdk1.5.0_05\lib\tools.jar</docletPath><br /> </configuration><br /> </plugin><br /> </p> <h2>Reporting</h2> <p>See <a class="confluence-link" href="/display/MAVENUSER/Reporting+Plugins" data-linked-resource-id="47196" data-linked-resource-type="page" data-linked-resource-default-alias="Reporting Plugins" data-base-url="http://docs.codehaus.org">Reporting Plugins</a> for an example of configuring the Javadoc plugin in the <reporting> section of the pom.</p> <h2>Linking to external Javadocs</h2> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <plugin> <artifactId>maven-javadoc-plugin</artifactId> <configuration> <aggregate>true</aggregate> <links> <link>http://java.sun.com/j2se/1.4.2/docs/api</link> <link>http://jakarta.apache.org/commons/chain/apidocs</link> </links> </configuration> </plugin> </pre></td></tr></table> <h2>Aggregating Javadoc jars</h2> <p>Aggregating Javadoc for the website is described <a href="http://maven.apache.org/plugins/maven-javadoc-plugin/examples/aggregate.html">here</a>.</p> <p>According to <a href="http://maven.apache.org/plugins/maven-javadoc-plugin/jar-mojo.html">this</a>, aggregation should also work for javadoc:jar.</p> <p>Example taken from <a href="http://www.avajava.com/tutorials/lessons/how-do-i-generate-and-deploy-a-javadoc-jar-file-for-my-project.html">here</a>:</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <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> </pre></td></tr></table> <h2>Deploying Javadoc to a Remote Server (Windows, Putty, SCP)</h2> <p>So you want to generate Javadoc and put it on a web server for the world (or your company) to see. You just want the Javadoc; you don't want a site. And you don't want to have to set up key pairs for authentication with your web server; you just want to SCP the files with a username and password.</p> <p>This is possible to do but takes a bit of maneuvering. The long and short of it is that you call the site-deploy goal of the maven-site-plugin, but tell it the site root is the apidocs directory.</p> <p>To get started, give Maven the SSH login credentials for your Javadoc web server. You do this using a <server> tag in your settings.xml file.</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <server> <id>someServer</id> <username>bob</username> <password>12345</password> <filePermissions>644</filePermissions> <directoryPermissions>755</directoryPermissions> <configuration> <sshExecutable>plink</sshExecutable> <scpExecutable>pscp</scpExecutable> </configuration> </server> </pre></td></tr></table> <p>(BEGIN ASIDE: Unfortunately, the <sshExecutable> tag above is not properly parsed by the 2.0-beta-6 version of the maven-site-plugin. You will need to get the 2.0-beta-7-SNAPSHOT version for the remote copy to work. To do this, add the snapshot repository as</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <repository> <id>apache.org</id> <name>Apache Maven Snapshot Repository</name> <url>http://people.apache.org/repo/m2-snapshot-repository</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </pre></td></tr></table> <p>and add the plugin dependency to your project POM file as</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <version>2.0-beta-7-SNAPSHOT</version> </dependency> </pre></td></tr></table> <p>END:ASIDE)</p> <p>You now need to configure the site plugin in your POM file. For starters, you want to generate Javadoc. To do this, set your reporting tag to</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.4</version> </plugin> </plugins> </reporting> </pre></td></tr></table> <p>In your <build> tag, configure the site plugin to only look at the apidocs directory...</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <version>2.0-beta-7-SNAPSHOT</version> <configuration> <inputDirectory>${project.reporting.outputDirectory}/apidocs</inputDirectory> </configuration> </plugin> </pre></td></tr></table> <p>Finally, configure your distribution management to distribute the site to the Javadoc web server...</p> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <distributionManagement> <site> <id>someServer</id> <url>scpexe://somePath</url> </site> </distributionManagement> </pre></td></tr></table> <p>That should do it. Run</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> mvn site-deploy </pre></td></tr></table> <p>and Maven should build your site and upload the Javadoc directory to your web server. If you get an error that the host is not recognized, make sure you SSH to your web server using Putty at least once in order to establish trust between your machine and the server.</p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced