From 8b701d94e62e7f8fa58d7b077fb047d0a96a43ca Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Wed, 23 Oct 2024 13:13:05 +0200 Subject: [PATCH] OZG-6839: Remove excludes, add file extensions, add documentation. --- README.md | 1 + ozgcloud-common-license/readme.md | 97 ++++++++++++++++++------------- pom.xml | 8 +-- 3 files changed, 61 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 0b91c35..f779e8b 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ * Update protoc-gen to 1.66 * Update Quarkus Platform to 3.13.3 * Update Keycloak Adapter to 24.0.5 +* Update [OZGCloud License Generator](ozgcloud-common-license/readme.md) ### 4.3.2 * update mapstruct 1.5.5 -> 1.6.0 diff --git a/ozgcloud-common-license/readme.md b/ozgcloud-common-license/readme.md index c471a27..b3524b9 100644 --- a/ozgcloud-common-license/readme.md +++ b/ozgcloud-common-license/readme.md @@ -1,40 +1,75 @@ -com.mycila# OzgCloud Common license +# OzgCloud Common license -This is a basic Maven-based project that can be used as license provider for all OzgCloud Projects +This is a license provider for all OzgCloud Projects. -It provides the the header and full text of the german [EUPL Version 1.2 license][license] +It uses the ["license-maven-plugin"](https://github.com/mathieucarbou/license-maven-plugin/). +It contains the header and full text of the german [EUPL Version 1.2 license](https://eupl.eu/1.2/de/). The header file is templated to get the correct "year of introduction" for one specific file. The mechanism uses the Git history. -## Usage +> [!NOTE] +> Some developers have a license-header with a *fixed* "year-of-introduction" in their IDE (see [project-setup](https://git.ozg-sh.de/ozgcloud-doc/dokumentation/src/branch/master/Entwicklungsumgebung#code-templates)). Running the plugin may overwrite this value (surprisingly) to a correct value from the Git History. -It is a library, meant to be included as a dependency on any project which may want to make use of it. +The recommendation is to use the (managed) preconfiguration which ideally suits every project. This config is part of OZG-Parent-Projects ([common-lib](../pom.xml) or [ozgcloud-common-parent](../ozgcloud-common-parent/pom.xml)). -To use it add +The plugin may get executed: +* manually - When a developer has to (bulk-) update all files in a project +* Pre-Push-Hook - To make sure, all pushed files contain license headers + +## Commands + +To add or update the license header to file run: +```bash +mvn license:format +``` + +To verify if there are files with missing license header run: +```bash +mvn license:check +``` + +## Configuration + +### Use managed Version +Add inceptionYear to your project pom.xml: ```xml -<ozgcloud.license.version>1.4.0</ozgcloud.license.version> +<inceptionYear>2020</inceptionYear> ``` -to the properties section of the pom.xml file. -In the plugins section add +Add this section to your project main pom.xml: +```xml +<build> + <pluginManagement> + <plugins> + <plugin> + <groupId>com.mycila</groupId> + <artifactId>license-maven-plugin</artifactId> + </plugin> + </plugins> + </pluginManagement> +</build> +``` +It will include the preconfigured License-Plugin to your project. + +### Use custom version (older approach) +> [!CAUTION] +> The preconfigured License-Plugin is extended to review Git-History to find the "Year of inception" for a file (see [OZG-6839](https://jira.mgm-tp.com/jira/browse/OZG-6839)) +> If your custom configuration uses the provided [header.txt](src/main/resources/license/eupl_v1_2_de/header.txt), without the Git-Plugin, the year will be missing. + +In your properties section of the pom.xml, add the current version of this: + +```xml +<ozgcloud.license.version>1.8.0</ozgcloud.license.version> +``` +In the plugins section add: ```xml <plugin> <groupId>com.mycila</groupId> <artifactId>license-maven-plugin</artifactId> - <version>4.1</version> + <version>4.6</version> <configuration> - <licenseSets> - <licenseSet> - <header>license/eupl_v1_2_de/header.txt</header> - <excludes> - <exclude>**/README</exclude> - <exclude>src/test/resources/**</exclude> - <exclude>src/main/resources/**</exclude> - <exclude>pom.xml</exclude> - </excludes> - </licenseSet> - </licenseSets> + <!-- Your custom configuration --> </configuration> <dependencies> <dependency> @@ -44,22 +79,4 @@ In the plugins section add </dependency> </dependencies> </plugin> -``` -To add or update the license header to file run -``` -mvn license:format -``` - -To verify if there are files with missing lisence header run -``` -mvn license:check -``` - -For more information about the usage see the [Plugin Homepage][pluginHomePage] - -## License - -The project has been released under the [EUPL License][license]. - -[license]: https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 -[pluginHomePage]: https://mycila.carbou.me/license-maven-plugin/ +``` \ No newline at end of file diff --git a/pom.xml b/pom.xml index cdc6d60..53c3b1c 100644 --- a/pom.xml +++ b/pom.xml @@ -91,15 +91,13 @@ <mapping> <proto>SLASHSTAR_STYLE</proto> <config>SCRIPT_STYLE</config> + <md>XML_STYLE</md> + <yml>SCRIPT_STYLE</yml> + <acss>JAVADOC_STYLE</acss> </mapping> <licenseSets> <licenseSet> <header>license/eupl_v1_2_de/header.txt</header> - <excludes> - <exclude>**/README</exclude> - <exclude>src/test/resources/**</exclude> - <exclude>src/main/resources/**</exclude> - </excludes> </licenseSet> </licenseSets> </configuration> -- GitLab