An open API service indexing awesome lists of open source software.

https://github.com/chonton/readfiles-maven-plugin

Read Files into Maven Properties
https://github.com/chonton/readfiles-maven-plugin

maven-plugin

Last synced: 6 months ago
JSON representation

Read Files into Maven Properties

Awesome Lists containing this project

README

        

# readfiles-maven-plugin

Read files into maven properties.

Mojo details at [plugin info](https://chonton.github.io/readfiles-maven-plugin/0.0.1/plugin-info.html)

Just one goal: [readfiles](https://chonton.github.io/readfiles-maven-plugin/0.0.1/readfiles-mojo.html)
sets maven properties to the contents of files. Each file is read fully and the contents are
set to maven properties of the same name as the files.

Optionally, the contents of the file can be trimmed of whitespace, or transformed using a series of
regular expression patterns and replacements.

| Parameter | Default | Property | Description |
|-------------------|---------|---------------------------------|------------------------------------------------|
| files | | | The list of files to read |
| encoding | UTF-8 | ${project.build.sourceEncoding} | The character encoding of the file |
| prefix | | ${readfiles.prefix} | Prefix each property name with this value |
| regexReplacements | | | List of pattern replacements |
| skip | false | ${readfiles.skip} | Skip executing the plugin |
| trim | false | ${readfiles.skip} | Trim whitespace from beginning and end of file |

## regexReplacement Elements
| Parameter | Description |
|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
| pattern | A [java regular expression](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/regex/Pattern.html) |
| replacement | The [replaceAll value](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/regex/Matcher.html#replaceAll(java.lang.String)) |

## Typical use:

```xml


org.honton.chas
readfiles-maven-plugin
0.1.0


configurations

readfiles




${basedir}/src/main/resources/application.json

${basedir}/src/main/resources/environment.conf




index.html

readfiles


iso-8859-1
page.


${basedir}/src/main/resources/index.html






```

## Pattern Replacement:

```xml

org.honton.chas
readfiles-maven-plugin


${basedir}/.nvmrc



^v?(\S+)\s*$
v$1




```