Home > Software Development > How to Add Copyright Notice in JavaDoc

How to Add Copyright Notice in JavaDoc

October 8th, 2013 Leave a comment Go to comments

While using Netbeans IDE to generate Javadoc for a Maven project, I noticed the generated pages has a default copyright notice at the bottom of every page, say “Copyright 2013. All Rights Reserved.” Because it’s default, it does not show the name of copyright owner. To change it, I found it’s not really straight-forward, therefore it may be worthwhile to share it.

It turned out that the default copyright right notice shows up as a bottom text. In other words, copyright right notice is one kind of bottom text. If you change the text of the bottom to be copyright notice, you are done.

Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.

In the Javadoc Maven plugin, there is an optional parameter called bottom. You can set your copyright notice as its value. According to the documentation:

Specifies the text to be placed at the bottom of each output file.
If you want to use html you have to put it in a CDATA section,
eg. <![CDATA[Copyright 2005, <a href="http://www.mycompany.com">MyCompany, Inc.<a>]]>
See bottom.
Default value is: Copyright &#169; {inceptionYear}&#x2013;{currentYear} {organizationName}. All rights reserved..
User property is: bottom.

Later on, I found it’s not quite true with the requirement on CDATA. Normal HTML seems to work just fine, for example,

bottom=Copyright &copy; 2013, <a href="http://www.doublecloud.org">DoubleCloud LLC<a>. All Rights Reserved.

With Netbeans (mine is 7.3.1), you can right click a project for “Project Properties” dialog box. Then, select the “Actions” from the left side tree. On the right side list of Actions, pick the “Generate Javadoc” action. The “Execute Goals” will display “generate-sources javadoc:javadoc”. Click on the “Add>” buttom right below the “Set Properties” label, and from the drop-down list select “Plugin Expression Property.” From the new “Add Plugin Expression Property” expand the “org.apache.maven.plugins:maven-javadoc-plugin [javadoc]” for the “bottom (buttom)” and click “OK” button. The edit area now has “bottom=” and you can add the copyright notice there.

After this setting, you can then right click the project and pick “Generate Javadoc” context menu to generate a new javadoc with the new copyright notice. As mentioned earlier, copyright notice is one kind of bottom text. You can add whatever valid HTML snippet there, be it a copyright notice or not.

  1. November 23rd, 2013 at 20:39 | #1

    Great post. I was checking continuously thos blog and I’m impressed!

    Very useful information specially the last part :) I care for such info much.

    I was looking for this particular info for a
    very long time. Thank you and best of luck.

  1. No trackbacks yet.