hi community, At present, there are problems in our project that the license header is not uniform and missing. Need a way to help developers automatically add and format the license header of the source files. Before that I submitted a pr[1].
There are two major options to automatically add license headers to source files: - Mojo License Maven plugin from codehaus - Mycila Maven License plugin from mycila 1. codehaus used in our projects is used to check third-party dependencies license and defined in licenseCheck profile(not default build plugin. It can be reused and updated license header,ref to update-file-header <https://www.mojohaus.org/license-maven-plugin/update-file-header-mojo.html#projectName>. It automatically supports [cddl_v1, gpl_v3, mit, gpl_v2, gpl_v1, fdl_v1_3, epl_v2, epl_v1, epl_only_v2, epl_only_v1, agpl_v3, lgpl_v3, lgpl_v2_1, apache_v2, eupl_v1_1, bsd_3, bsd_2] license. Here our apache_v2 header is different from our ASF header, so we can't use the existing one directly. We need to define our license header using licenseResolver, but here we need to define each module and fixed file name, ref to example-add-license <https://www.mojohaus.org/license-maven-plugin/examples/example-add-license.html>. so I think that the codehaus plugin is difficult to use as an update license header, I recommend using Mycila to format the license header of the source file. When we finish the code locally and do the maven compile check, it can automatically check the headers of all source files, add the headers that don't exist, and update the headers with incorrect formats. 2. A bad news is that Mycila was last released three years ago, but its Its associated github <https://github.com/mycila/license-maven-plugin> was updated 4 months ago. The current version of mycila is 3.0. I think the function is clear for Mycila. Currently we need the format function, which is undoubtedly satisfied. 3. rat plugin <https://creadur.apache.org/rat/apache-rat-plugin/index.html> just check license header but not update and format license header.I hope there is a plugin that automatically helps developers format their license header. I think it can be divided into two steps for the existing problems. - Firstly, add or format the license header for the existing source file, but not include the plugin itself. - Secondly, discuss how to use the plugin to help us automatically add and format the license header in our project. What do you think? Any suggestions? [1] https://github.com/apache/dubbo/pull/4229
