mojohaus/license-maven-plugin

trimHeaderLine removes empty lines from license text in html files

Open

#347 opened on Jul 29, 2019

View on GitHub
 (6 comments) (0 reactions) (0 assignees)Java (127 forks)auto 404
file-headerhelp wanted

Repository metrics

Stars
 (115 stars)
PR merge metrics
 (PR metrics pending)

Description

Assume your license text looks like this (with a blank line somewhere in the middle):

first line of license

second line
third line

If you set trimHeaderLine=true license-maven-plugin will correctly trim trailing white spaces in Java files (and all other file types where each line of the resulting license header is starting with a comment symbol), e.g.:

/*-
 * #%L
 * foo
 * %%
 * Copyright (C) 2018 - 2019 bar
 * %%
 * first line of license
 * 
 * second line
 * third line
 * #L%
 */

But in html files, the blank line will be removed when running the update-file-header goal a second time.

Result of first run - no trailing white spaces, blank line still included:

<!--
  #%L
  foo
  %%
  Copyright (C) 2018 - 2019 bar
  %%
  first line of license

  second line
  third line
  #L%
  -->

Result of second run - no trailing white spaces, but blank line is removed:

<!--
  #%L
  foo
  %%
  Copyright (C) 2018 - 2019 bar
  %%
  first line of license
  second line
  third line
  #L%
  -->

When setting trimHeaderLine=false, the license header will not change between runs for html files. Unfortunately, then you get a trailing whitespace at the empty line in the license header of java files. And then checkstyle complains...

Contributor guide