Skip to content

Commit

Permalink
Update to license-maven-plugin:4.1
Browse files Browse the repository at this point in the history
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.

Related issue: logfellow#549
  • Loading branch information
brenuart committed Jul 6, 2021
1 parent fa81678 commit 4d14e14
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 18 deletions.
34 changes: 33 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,44 @@ 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:

```
/**
* 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 https://github.com/mathieucarbou/license-maven-plugin[Mycila Maven License 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).

37 changes: 20 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<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>
<license-maven-plugin.version>4.1</license-maven-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 @@ -268,26 +268,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 @@ -421,6 +408,22 @@
</dependencies>
</plugin>

<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>${license-maven-plugin.version}</version>
<configuration>
<header>license-header.txt</header>
<mapping>
<java>JAVADOC_STYLE</java>
</mapping>
<includes>
<include>src/main/java/**</include>
<include>src/test/java/**</include>
</includes>
</configuration>
</plugin>

<!-- This plugin's configuration is used to store Eclipse m2e settings only.
It has no influence on the Maven build itself.
-->
Expand Down

0 comments on commit 4d14e14

Please sign in to comment.