CASSANDRASC-61: Add Release Audit Tool (RAT) plugin to Sidecar

This commit adds the Release Audit Tool (RAT) plugin to `build.gradle` which
adds a new build task `rat`. This new task will make sure that the license
headers are present in source files during the `check` task.

To run the RAT plugin, you can run:

```
./gradlew rat
```

patch by Francisco Guerrero; reviewed by Dinesh Joshi, Michael Semb Wever for CASSANDRASC-61
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 124250f..7e91c83 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,3 +1,21 @@
+#
+# 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.
+#
+
 # Java Gradle CircleCI 2.0 configuration file
 #
 # Check https://circleci.com/docs/2.0/language-java/ for more details
@@ -49,7 +67,7 @@
 
      - run: BRANCHES="cassandra-4.0 cassandra-4.1" scripts/build-dtest-jars.sh
      - run: echo 'export DTEST_JAR=$(cd dtest-jars && find . -name 'dtest-4.1*.jar' -maxdepth 1)' >> "$BASH_ENV"
-     - run: ./gradlew -i test integrationTest --stacktrace -Dcassandra.sidecar.versions_to_test="4.0,4.1"
+     - run: ./gradlew --info check --stacktrace -Dcassandra.sidecar.versions_to_test="4.0,4.1"
 
      - store_artifacts:
          path: build/reports
@@ -66,7 +84,7 @@
       - checkout
 
       - run: CASSANDRA_USE_JDK11=true scripts/build-dtest-jars.sh
-      - run: ./gradlew -i test integrationTest --stacktrace
+      - run: ./gradlew --info check --stacktrace
 
       - store_artifacts:
           path: build/reports
@@ -110,7 +128,8 @@
     steps:
       - checkout
       - run: ./gradlew docs:asciidoctor
-      - run: test -f docs/build/html5/user.html
+      - run: test -f docs/build/user.html
+      - run: test -f docs/build/development.html
 
 workflows:
   version: 2
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5d61de0..2a02db0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,3 +1,23 @@
+<!--
+#
+# 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.
+#
+-->
+
 # Contributing to Apache Cassandra Sidecar
 
 We warmly welcome and appreciate contributions from the community.
diff --git a/README.md b/README.md
index 3bcbe16..622a7bb 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,23 @@
+<!--
+#
+# 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.
+#
+-->
+
 # Apache Cassandra Sidecar [WIP]
 
 This is a Sidecar for the highly scalable Apache Cassandra database.
diff --git a/adapters/base/build.gradle b/adapters/base/build.gradle
index 50b3d93..cf14e7c 100644
--- a/adapters/base/build.gradle
+++ b/adapters/base/build.gradle
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 plugins {
     id 'java-library'
     id 'idea'
diff --git a/build.gradle b/build.gradle
index dd07dfe..ef7b7bc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,3 +1,24 @@
+/*
+ * 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.
+ */
+
+
+import java.nio.file.Files
 import java.nio.file.Paths
 
 buildscript {
@@ -23,8 +44,12 @@
     id 'nebula.ospackage-application' version "8.3.0"
     id 'com.google.cloud.tools.jib' version '2.2.0'
     id 'org.asciidoctor.jvm.convert' version '3.1.0'
+
+    // Release Audit Tool (RAT) plugin for checking project licenses
+    id("org.nosphere.apache.rat") version "0.8.0"
 }
 
+
 ext.dtestJar = System.getenv("DTEST_JAR") ?: "dtest-5.0.jar" // trunk is currently 5.0.jar - update when trunk moves
 println("Using DTest jar: ${ext.dtestJar}")
 
@@ -341,6 +366,48 @@
     into ""
 }
 
+tasks.register('buildIgnoreRatList', Exec) {
+    description 'Builds a list of ignored files for the rat task from the unversioned git files'
+    commandLine 'bash', '-c', "git clean --force -d --dry-run -x | cut -c 14-"
+    doFirst {
+        standardOutput new FileOutputStream("${buildDir}/.rat-excludes.txt")
+    }
+    // allows task to fail when git/cut commands are unavailable or fail
+    ignoreExitValue = true
+}
+
+rat {
+
+    doFirst {
+        def excludeFilePath = Paths.get("${buildDir}/.rat-excludes.txt")
+        def excludeLines = Files.readAllLines(excludeFilePath)
+        excludeLines.each { line ->
+            if (line.endsWith("/")) {
+                excludes.add("**/" + line + "**")
+            } else {
+                excludes.add(line)
+            }
+        }
+    }
+
+    // List of Gradle exclude directives, defaults to ['**/.gradle/**']
+    excludes.add("**/build/**")
+    excludes.add("CHANGES.txt")
+
+    // Documentation files
+    excludes.add("**/docs/src/**")
+    // gradle files
+    excludes.add("gradle/**")
+    excludes.add("gradlew")
+    excludes.add("gradlew.bat")
+
+    // resource files for test
+    excludes.add("**/test**/resources/**")
+
+    // XML, TXT and HTML reports directory, defaults to 'build/reports/rat'
+    reportDir.set(file("build/reports/rat"))
+}
+
 integrationTest.onlyIf { "true" != System.getenv("skipIntegrationTest") }
 
 // copyDist gets called on every build
@@ -348,3 +415,7 @@
 check.dependsOn checkstyleMain, checkstyleTest, integrationTest, jacocoTestReport
 build.dependsOn copyDist, copyJolokia, copyDocs
 run.dependsOn build
+
+tasks.named('rat').configure {
+    dependsOn(buildIgnoreRatList)
+}
diff --git a/client/README.md b/client/README.md
index c6e79a7..7594edc 100644
--- a/client/README.md
+++ b/client/README.md
@@ -1,3 +1,23 @@
+<!--
+#
+# 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.
+#
+-->
+
 # Cassandra Sidecar Client
 
 The Sidecar Client is a fully featured client to access Cassandra Sidecar endpoints. It offers support for
diff --git a/client/build.gradle b/client/build.gradle
index 85165a9..44e359a 100644
--- a/client/build.gradle
+++ b/client/build.gradle
@@ -1,5 +1,3 @@
-import java.nio.file.Paths
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,6 +16,8 @@
  * limitations under the License.
  */
 
+import java.nio.file.Paths
+
 plugins {
     id('idea')
     // A Java library
diff --git a/common/build.gradle b/common/build.gradle
index aa42bea..dd9fad1 100644
--- a/common/build.gradle
+++ b/common/build.gradle
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 plugins {
     id 'java-library'
     id "java-test-fixtures"
diff --git a/docs/build.gradle b/docs/build.gradle
index bd76db0..2e89885 100644
--- a/docs/build.gradle
+++ b/docs/build.gradle
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 apply plugin: 'org.asciidoctor.jvm.convert'
 
 asciidoctor {
diff --git a/gradle.properties b/gradle.properties
index d1ac405..60be724 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,3 +1,21 @@
+#
+# 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.
+#
+
 version=1.0-SNAPSHOT
 junitVersion=5.9.2
 vertxVersion=4.2.1
diff --git a/ide/idea/codeStyleSettings.xml b/ide/idea/codeStyleSettings.xml
index d9190a7..951b66f 100644
--- a/ide/idea/codeStyleSettings.xml
+++ b/ide/idea/codeStyleSettings.xml
@@ -1,4 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
 <project version="4">
   <component name="ProjectCodeStyleSettingsManager">
     <option name="PER_PROJECT_SETTINGS">
@@ -272,4 +288,4 @@
     </option>
     <option name="USE_PER_PROJECT_SETTINGS" value="true" />
   </component>
-</project>
\ No newline at end of file
+</project>
diff --git a/ide/idea/copyright/profiles_settings.xml b/ide/idea/copyright/profiles_settings.xml
index 5448281..d21f0b1 100644
--- a/ide/idea/copyright/profiles_settings.xml
+++ b/ide/idea/copyright/profiles_settings.xml
@@ -1,3 +1,20 @@
+
+<!--
+  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.
+-->
 <component name="CopyrightManager">
   <settings default="Apache License 2.0" />
-</component>
\ No newline at end of file
+</component>
diff --git a/settings.gradle b/settings.gradle
index c723715..1eb9963 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 rootProject.name = "cassandra-sidecar"
 
 include "adapters:base"
diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml
index 7085a6e..46f0f39 100644
--- a/spotbugs-exclude.xml
+++ b/spotbugs-exclude.xml
@@ -1,4 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
 <FindBugsFilter
         xmlns="https://spotbugs.readthedocs.io/en/stable/filter.html"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
diff --git a/src/main/dist/conf/sidecar.yaml b/src/main/dist/conf/sidecar.yaml
index c33936e..33e4178 100644
--- a/src/main/dist/conf/sidecar.yaml
+++ b/src/main/dist/conf/sidecar.yaml
@@ -1,4 +1,22 @@
 #
+# 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.
+#
+
+#
 # Cassandra SideCar configuration file
 #
 cassandra_instances:
diff --git a/src/main/resources/docs/index.html b/src/main/resources/docs/index.html
index c73772f..069bf1a 100644
--- a/src/main/resources/docs/index.html
+++ b/src/main/resources/docs/index.html
@@ -1,5 +1,21 @@
 <!-- HTML for static distribution bundle build -->
 <!DOCTYPE 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
+  limitatins under the License.
+-->
 <html lang="en">
 <head>
   <meta charset="UTF-8">
diff --git a/vertx-client/src/test/resources/log4j2.xml b/vertx-client/src/test/resources/log4j2.xml
index e5b017f..3adc053 100644
--- a/vertx-client/src/test/resources/log4j2.xml
+++ b/vertx-client/src/test/resources/log4j2.xml
@@ -1,4 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
 <Configuration status="ERROR">
     <Properties>
         <Property name="LOG_PATTERN">%d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} %p %m%n</Property>