Skip to content

Commit

Permalink
Update to license-maven-plugin:4.1 (logfellow#550)
Browse files Browse the repository at this point in the history
* Update to license-maven-plugin:4.1

- Update POM to use the latest version of the Mycila license plugin (and correct GAV).
- Move plugin configuration inside the <pluginManagement> section so the plugin can be manually invoked from the command line. Particularly handy to fix header issues automatically…
- Change the build process to “check” the files only and fail the build if not valid.
- Remove the custom lifecycle-mapping: latest versions of the plugin have support for M2E
- Change comment style from JAVADOC to SLASHSTAR
- Add copyright as first line
- Update test case with a different expected hash caused by the additional lines in the license header

Related issue: logfellow#549
  • Loading branch information
brenuart authored Jul 7, 2021
1 parent 8d96448 commit b1ec1db
Show file tree
Hide file tree
Showing 229 changed files with 733 additions and 269 deletions.
36 changes: 35 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,46 @@ Source Code Style
-----------------

Please follow the style used by the existing code in the repository.

Rules are enforced by [checkstyle](src/checkstyle/checkstyle.xml).

Java source files must include the following header at the top of the file, before the _package_ declaration:

```
/*
* Copyright 2013-${year} the original author or authors.
*
* Licensed 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.
*/
```

The project makes use of the great [Mycila Maven License Plugin](https://github.com/mathieucarbou/license-maven-plugin) to check for the presence of a valid header in source files during the build process.

You can manually check your source files by invoking the plugin manually on the command line as follows:

```
mvn license:check
```

You can also ask the plugin to automatically update the header for you like this:

```
mvn license:format
```


License
-------

By contributing, you agree that the contributions will be licensed under the
[Apache License 2.0](https://github.com/logstash/logstash-logback-encoder/blob/main/LICENSE).

2 changes: 2 additions & 0 deletions license-header.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Copyright 2013-${year} the original author or authors.

Licensed 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
Expand Down
60 changes: 19 additions & 41 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<name>Logstash Logback Encoder</name>
<description>Provides logback encoders, layouts, and appenders to log in JSON and other formats supported by Jackson</description>
<url>https://github.com/logstash/logstash-logback-encoder</url>
<inceptionYear>2013</inceptionYear>

<scm>
<url>https://github.com/logstash/logstash-logback-encoder</url>
Expand Down Expand Up @@ -36,7 +37,7 @@

<!-- maven plugins -->
<animal-sniffer-maven-plugin.version>1.20</animal-sniffer-maven-plugin.version>
<lifecycle-mapping.version>1.0.0</lifecycle-mapping.version>
<license-maven-plugin.version>4.1</license-maven-plugin.version>
<maven-bundle-plugin.version>5.1.2</maven-bundle-plugin.version>
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
<maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
Expand All @@ -45,7 +46,6 @@
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
<maven-javadoc-plugin.version>3.3.0</maven-javadoc-plugin.version>
<maven-license-plugin.version>1.9.0</maven-license-plugin.version>
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
Expand Down Expand Up @@ -269,26 +269,13 @@
<version>${maven-release-plugin.version}</version>
</plugin>
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<version>${maven-license-plugin.version}</version>
<configuration>
<header>license-header.txt</header>
<strictCheck>true</strictCheck>
<aggregate>true</aggregate>
<encoding>UTF-8</encoding>
<failIfMissing>true</failIfMissing>
<skipExistingHeaders>true</skipExistingHeaders>
<includes>
<include>**/src/main/java/**</include>
<include>**/src/test/java/**</include>
</includes>
</configuration>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
Expand Down Expand Up @@ -445,31 +432,22 @@
</dependencies>
</plugin>

<!-- This plugin's configuration is used to store Eclipse m2e settings only.
It has no influence on the Maven build itself.
-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>${lifecycle-mapping.version}</version>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>${license-maven-plugin.version}</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<versionRange>[1.9.0,)</versionRange>
<goals>
<goal>format</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
<header>license-header.txt</header>
<mapping>
<java>SLASHSTAR_STYLE</java>
</mapping>
<includes>
<include>src/main/java/**</include>
<include>src/test/java/**</include>
</includes>
<defaultProperties>
<year>2021</year>
</defaultProperties>
</configuration>
</plugin>
</plugins>
Expand Down
2 changes: 1 addition & 1 deletion src/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@
<module name="UpperEll"/>
</module>
<module name="RegexpHeader">
<property name="header" value="^/\*\*\n^ \* Licensed under the Apache License, Version 2\.0 \(the &quot;License&quot;\);"/>
<property name="header" value="^/\*\n^ \* Copyright .* the original author or authors\.\n^ *\n^ \* Licensed under the Apache License, Version 2\.0 \(the &quot;License&quot;\);"/>
</module>
</module>
4 changes: 3 additions & 1 deletion src/main/java/net/logstash/logback/CachingAbbreviator.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/net/logstash/logback/LogstashFormatter.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/net/logstash/logback/NullAbbreviator.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed 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
Expand Down
Loading

0 comments on commit b1ec1db

Please sign in to comment.