Fork me on GitHub

Overview

This page describes the file header model. You will learn how to customize it and use it with the goal update-file-header.

Header model

The header model defines how to display the header on each file.

This header is boxed in a comment proper to each type of file (we call it comment box).

Example

Here is an example of a file header (with NO comment box) :

  (1) # % L
  (2) Project description
  (3) %%
  (4) Copyright (C) 2010 your organization
  (5) %%
  (6) License content
  (7) # L %
  • (1) the start process tag used to detect begin of header (NEVER suppress it).
  • (2) Project description section
  • (3) Header section delimiter
  • (4) Copyright section of the file (see next section for detail)
  • (5) Header section delimiter
  • (6) License section
  • (7) the end process tag used to detect end of header (NEVER suppress it).

Configuration

You can configure these things:

Note:

  • The plugin won't be able to migrate from a header configuration to another one, so prepare this configuration before the first execution of the goal (and never change it :().
  • As the configuration has a special meaning for the goal to treat a file and should not be able to be found more than once in a file, we can use special space separator, the goal will remove then. In that way the exact configuration won't be found twice in your pom.xml.

Description section template

Since version 1.1, it is possible to customize the description section using a freemarker template.

Default template is given to reproduce exactly the previous hardcoded description.

See example for more details.

Copyright model

Copyright section must exactly be of this form :

  Copyright (C) firstYear[ - lastYear] holder

If firstYear and lastYear are the same then lastYear is omitted.

Comment box

In a file, we must box the file header in a comment. In the descriptor file you can customize it by choosing a headerType.

Available comment styles

Here are the available comment styles.

Using the goal comment-style-list you can find all of them.

java style

  /*
   * HEADER
   */

xml style

  <!--
   HEADER
  -->

properties style

  ######
  # HEADER
  ######

apt style

  ~~~~~~
  ~~ HEADER
  ~~~~~~

rst style

  .. -
  .. * HEADER
  .. -

jsp style

  <%--
   HEADER
  --%>

sql style

  ---
  -- HEADER
  ---

mysql style

  -- -
  -- HEADER
  -- -

Note that for mysql, you can not use the simplesql file header (see http://jira.codehaus.org/browse/MLICENSE-56)

freemarker style

  <#--
  -- HEADER
  -->

php style

  <?php /*
  * HEADER
  */ ?>

Ignore a header

If you don't want update-file-header goal to treat a specific file, you can use a specific tag in your file:

  %%Ignore-License

Note : Don't use start (1) and end (7 in example) balise You can change it with ignoreTag property.