[Hawkular-dev] How to work with the license plugin

Peter Palaga ppalaga at redhat.com
Fri Jan 23 10:01:46 EST 2015


Hi *,

Have you ever updated the copyright range after you changed a file?

To spare us from the tedious manual work and to bring in consistency and 
standards required by Red Hat Legal dept., the license plugin was 
recently included [1] in metrics. Other projects will follow soon.

Here here is a couple of recommendations how to work with the plugin:

(1) Having the file templates up to date in your IDE can save you some work

  git clone  https://github.com/hawkular/hawkular-build-tools.git
  cd hawkular-build-tools/ide-configs

... and import what is there. If your IDE is not supported, you are 
welcome to contribute a configuration. Nevertheless, one can work 
without an IDE support, see (2).

(2) The license plugin is able to add/fix licenses as necessary. Just invoke

    mvn license:format

in the root of your project (assuming license plugin is configured in 
the pom hierarchy.)

(3) The license:check goal is now bound to validation phase in metrics. 
It can make your build fail. If you want to avoid the checks for any 
reason (reduce build time, known temporary inconsistencies, ...) feel 
free to build with

   -Dlicense.failOnMissing=false

But note that Travis will fail if you push files that do not meet the 
standards.

(4) From my sustaining engineer's experience, I can say that it is often 
handy to have non-code changes in separate commits. This holds not only 
for code formatting but also for copyright range updates. Please keep 
them separate if possible.
A typical workflow might look like this:
   (i) code, build with -Dlicense.failOnMissing=false, commit
       as many times as you need
   (ii) mvn license:format; git commit -m "License headers added or
        fixed"
   (iii) git push ... ; hub pull-request ...

Thanks,

Peter

[1] https://github.com/rhq-project/rhq-metrics/pull/132


More information about the hawkular-dev mailing list