Gist & Cookbook ...

小目标:每天能够提交一行代码 ...

解决org.apache.rat:apache-rat-plugin check, Too many unapproved license

吴亮's Avatar 2020-02-05

  1. 1. 方法一:在各个源文件的头部添加版权信息
  2. 2. 方法二:跳过检查
  3. 3. 参考

在Maven打包时,遇到报错信息:

1
[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.8:check (default) on project hbase: Too many unapproved licenses: 513 -> [Help 1]

这个是因为有大量源文件缺少版权的头部信息。两种解决办法:

方法一:在各个源文件的头部添加版权信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

方法二:跳过检查

在maven命令中,添加参数:

1
-Dlicense.skip=true -Drat.ignoreErrors=true

或者添加参数:

1
apache-rat:check -Drat.numUnapprovedLicenses=9999

其中rat.numUnapprovedLicenses是需要检查源文件的阈值,可以设置得大一点。

参考

本文作者 : 吴亮
本文使用 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议
本文链接 : https://www.wuliang.me/how-to-skip-unapproved-license-check-in-maven/

本文最后更新于 天前,文中所描述的信息可能已发生改变