We’re missing license headers for our *.vm files. I’m proposing to use the following format:
#*
# ---------------------------------------------------------------------------
# See the NOTICE file distributed with this work for additional
# information regarding copyright ownership.
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this software; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
# ---------------------------------------------------------------------------
*#
## ---------------------------------------------------------------------------
## See the NOTICE file distributed with this work for additional
## information regarding copyright ownership.
##
## This is free software; you can redistribute it and/or modify it
## under the terms of the GNU Lesser General Public License as
## published by the Free Software Foundation; either version 2.1 of
## the License, or (at your option) any later version.
##
## This software is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this software; if not, write to the Free
## Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
## 02110-1301 USA, or see the FSF site: http://www.fsf.org.
## ---------------------------------------------------------------------------
new StringReader("##---------------------------------------------------------------------------\n"
+ "## See the NOTICE file distributed with this work for additional\n"
+ "## information regarding copyright ownership.\n"
+ "##\n"
+ "## This is free software; you can redistribute it and/or modify it\n"
+ "## under the terms of the GNU Lesser General Public License as\n"
+ "## published by the Free Software Foundation; either version 2.1 of\n"
+ "## the License, or (at your option) any later version.\n"
+ "##\n"
+ "## This software is distributed in the hope that it will be useful,\n"
+ "## but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
+ "## Lesser General Public License for more details.\n"
+ "##\n"
+ "## You should have received a copy of the GNU Lesser General Public\n"
+ "## License along with this software; if not, write to the Free\n"
+ "## Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n"
+ "## 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n"
+ "## ---------------------------------------------------------------------------\n"
+ "###\n"
+ "### Annotations page in the \"view\" mode\n"
+ "###\n"
+ "###\n"
+ "#if(\"$!request.xpage\" == 'annotations')\n"
+ " $response.sendRedirect($doc.getURL('view', 'viewer=annotations'))\n"
+ "#else\n"
+ " #set($titleToDisplay = $services.localization.render('core.viewers.annotations.title', [\"<a href='$doc.getURL()'>$escapetool.xml($doc.getPlainTitle())</a>\"]))\n"
+ " #template('contentheader.vm')\n"
+ " #template(\"annotationsinline.vm\")\n"
+ "#end\n"));
So, in addition the comments represent a large portion of this template which makes it worse than the reality probably.
Another idea would be to use a different syntax for the license headers for VM files and remove it at build time with Maven. For example by using the Maven Resources plugin and implementing some custom resource filter (Apache Maven Resources Plugin – Custom resource filters). The requirement for license header is to have them only in sources but not in binaries.
The not so esy part here is that we have different modules containing vm files and they use different maven plugins to package them: assembly plugin, war plugin, resources plugin. So it would mean inserting the execution of some custom plugin to remove the headers and copy the files in the target dir and then modify the pom.xml to make sure that the assembly plugin, war plugin & resources plugin get the vm files from the target dir.