Browse Source

Added licene-maven-plugin to build

The plugin adds basic checks for license headers. At
this stage we only enable checks for java source files.
Other files are omitted at this point.
mrsolo 11 years ago
parent
commit
2df42e4460
3 changed files with 63 additions and 1 deletions
  1. 16 0
      dev-tools/elasticsearch_license_header.txt
  2. 13 0
      dev-tools/license_header_definition.xml
  3. 34 1
      pom.xml

+ 16 - 0
dev-tools/elasticsearch_license_header.txt

@@ -0,0 +1,16 @@
+Licensed to Elasticsearch under one or more contributor
+license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright
+ownership. Elasticsearch 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.

+ 13 - 0
dev-tools/license_header_definition.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<additionalHeaders>
+    <javadoc_style>
+        <firstLine>/*</firstLine>
+        <beforeEachLine> * </beforeEachLine>
+        <endLine> */</endLine>
+        <!--skipLine></skipLine-->
+        <firstLineDetectionPattern>(\s|\t)*/\*.*$</firstLineDetectionPattern>
+        <lastLineDetectionPattern>.*\*/(\s|\t)*$</lastLineDetectionPattern>
+        <allowBlankLines>false</allowBlankLines>
+        <isMultiline>true</isMultiline>
+    </javadoc_style>
+</additionalHeaders>

+ 34 - 1
pom.xml

@@ -1073,7 +1073,40 @@
                     </execution>
                 </executions>
             </plugin>
-        </plugins>
+            <plugin>
+              <groupId>com.mycila</groupId>
+              <artifactId>license-maven-plugin</artifactId>
+              <version>2.5</version>
+              <configuration>
+                <header>dev-tools/elasticsearch_license_header.txt</header>
+                <headerDefinitions>
+                  <headerDefinition>dev-tools/license_header_definition.xml</headerDefinition>
+                </headerDefinitions>
+                <includes>
+                    <include>src/main/java/org/elasticsearch/**/*.java</include>
+                    <include>src/test/java/org/elasticsearch/**/*.java</include>
+                </includes>
+                <excludes>
+                    <exclude>src/main/java/org/elasticsearch/common/inject/**</exclude>  <!-- Guice -->
+                    <exclude>src/main/java/org/elasticsearch/common/geo/GeoHashUtils.java</exclude>
+                    <exclude>src/main/java/org/elasticsearch/common/lucene/search/XBooleanFilter.java</exclude>
+                    <exclude>src/main/java/org/elasticsearch/common/lucene/search/XFilteredQuery.java</exclude>
+                    <exclude>src/main/java/org/apache/lucene/queryparser/XSimpleQueryParser.java</exclude>
+                    <exclude>src/main/java/org/apache/lucene/**/X*.java</exclude>
+                </excludes>
+              </configuration>
+                <!--  We can't run by default since the package is broken with java 1.6
+                      see https://github.com/mycila/license-maven-plugin/issues/35
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                -->
+            </plugin>
+        </plugins>	
         <pluginManagement>
             <plugins>
                 <!-- make m2e stfu -->