https://github.com/miho/vliceneheaderutil
https://github.com/miho/vliceneheaderutil
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/miho/vliceneheaderutil
- Owner: miho
- Created: 2013-09-02T09:01:45.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-09-06T13:03:01.000Z (over 12 years ago)
- Last Synced: 2025-02-15T21:20:02.142Z (11 months ago)
- Language: Java
- Size: 305 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
VLiceneHeaderUtil
=================
Allows to automatically change license headers of `.java` source files based on a template.
## Requirements:
Only `.java` files can be processed and only if they contain a correct package declaration such as `package my.package;`.
Everything before the package declaration will be replaced by the header.
## How To Use It:
LicenseHeaderUtil.changeLicenseHeaderInDir(
Paths.get("sample-project/src"),
Paths.get("sample-project/src-out"), // could also be the same as above (overwrites src files)
Paths.get("sample-project/license-template.txt")
);
## Template File:
The template contains the license header. VLiceneHeaderUtil provides the actual file name via a variable `${VRL-LICENSE-HEADER-FILE-NAME}`.
The current date is also accessible (see example below).
Example:
/* ${VRL-LICENSE-HEADER-FILE-NAME}
*
* Date ${VRL-LICENSE-HEADER-DATE}
*
* Year ${VRL-LICENSE-HEADER-YEAR}
* Month ${VRL-LICENSE-HEADER-MONTH}
* Day ${VRL-LICENSE-HEADER-DAY}
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* THE LICENSE...
*/
## How To Use The Gradle Plugin:
To use the plugin add the following line to the `build.gradle` file:
apply from: 'http://gradle-plugins.mihosoft.eu/latest/vlicenseheader.gradle'
Now specify the license header template.
**Example:**
It is possible to specify the header as string:
repairHeaders.licenseHeaderText = 'license text'
or specify a file taht contains the template:
repairHeaders.licenseHeaderText = new File(projectDir,'license-template.txt')
Now call the `repairHeaders`task to add the license header to all source files.