On 07/09/16 12:04, Stian Soiland-Reyes wrote:
It should - if the script or maven plugin is able to cleanly remove
the old header.
I use perl:
undef $/ ;
s!/.*?\npackage!\npackage!s ;
i.e. remove everything up until the "package" on the start of a line.
This avoids having to match different layouts.
Andy
#!/usr/bin/perl
# find . -name \*.java | xargs -n 1 perl -i.bak SCRIPT
undef $/ ;
$_ = <> ;
# Remove initial comments.
s!/.*?\npackage!\npackage!s ;
# print LICENSE
$HEADER=<<'EOF';
/*
Your license goes here.
*/
EOF
print $HEADER ;
print $_ ;