Apache 2.0 许可证头合规检查
license-compliance
确保所有新文件都包含规范的 Apache 2.0 许可证头。在 Apache Beam 仓库中创建任何新文件时使用。
- License 许可
- Apache-2.0
- 所属仓库
- apache/beam
- 最近更新
- 2026-11-15
- Stars
- ★ 8.7k
- Forks
- 4.8k
01 前言 Front Matter
- name
- license-compliance
- description
- Ensures all new files include proper Apache 2.0 license headers. Use when creating any new file in the Apache Beam repository.
03 SKILL.md 正文
License Compliance in Apache Beam
Overview
Every source file in Apache Beam MUST include the Apache 2.0 license header. The RAT (Release Audit Tool) check will fail if any file is missing the required license.
License Headers by File Type
Java, Groovy, Kotlin, Scala
/*
* 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.
*/
Python
#
# 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.
#
Go
// 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.
Markdown (.md)
<!--
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.
-->
YAML (.yml, .yaml) and YAML Frontmatter
# 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.
Shell Scripts (.sh, .bash)
#!/bin/bash
#
# 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.
#
XML, HTML
<!--
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.
-->
RAT Check
Running Locally
./gradlew rat
Checking Results
If the RAT check fails, view the report:
build/reports/rat/index.html
Key Rules
- Every new file needs a license header - No exceptions for source files
- Place header at the very top - Before any code, imports, or declarations
- Use correct comment style - Match the file type's comment syntax
- YAML frontmatter exception - For files with YAML frontmatter (like SKILL.md), place the license as YAML comments inside the frontmatter block, after the opening
--- - Dependencies must be Apache-compatible - New dependencies need licenses compatible with Apache 2.0
Common Mistakes
- Forgetting to add headers to new test files
- Missing headers on configuration files (.yaml, .json, .xml)
- Adding HTML comments before YAML frontmatter (breaks parsing)
04 同仓库更多 Skills
Beam YAML SDK 开发
yaml-development
指导 Apache Beam 中的 YAML SDK 开发,包括环境搭建、测试和关键概念。在 sdks/python/apache_beam/yaml/ 目录下处理 Beam YAML 代码时使用。
Apache Beam Runner 配置与调试
runners
指导理解和使用 Apache Beam 的 Runner(Direct、Dataflow、Flink、Spark 等)。在为不同执行环境配置管道,或调试特定于 Runner 的问题时使用。
Apache Beam Python SDK 开发
python-development
指导 Apache Beam 中的 Python SDK 开发,包括环境配置、测试、构建和运行流水线(pipeline)。在 sdks/python/ 目录下处理 Python 代码时使用。
Apache Beam Java SDK 开发
java-development
指导 Apache Beam 中的 Java SDK 开发,包括构建、测试、运行示例以及理解项目结构。在 sdks/java/、runners/ 或 examples/java/ 目录下处理 Java 代码时使用。
Apache Beam I/O 连接器开发
io-connectors
指导 Apache Beam 中 I/O 连接器的开发和使用。适用于处理 I/O 连接器、创建新连接器,或调试数据源/接收器(source/sink)相关问题的场景。
Gradle 构建系统使用指南
gradle-build
指导理解和使用 Apache Beam 中的 Gradle 构建系统。适用于构建项目、理解依赖关系或排查构建问题时。