https://github.com/phax/ph-dirindex-maven-plugin
A Maven plugin for creating file list for later retrieval
https://github.com/phax/ph-dirindex-maven-plugin
Last synced: 2 months ago
JSON representation
A Maven plugin for creating file list for later retrieval
- Host: GitHub
- URL: https://github.com/phax/ph-dirindex-maven-plugin
- Owner: phax
- License: apache-2.0
- Created: 2014-08-26T14:57:43.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2025-12-16T19:49:03.000Z (5 months ago)
- Last Synced: 2025-12-20T10:50:57.669Z (5 months ago)
- Language: Java
- Size: 290 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# ph-dirindex-maven-plugin
[](https://javadoc.io/doc/com.helger.maven/ph-dirindex-maven-plugin)
[](https://maven-badges.herokuapp.com/maven-central/com.helger.maven/ph-dirindex-maven-plugin)
A Maven 3.x plugin for creating file list for later retrieval. This can be used to create a file list of one or more arbitrary directories to save it to a file. The resulting file can be used from another JAR file as a "table of contents".
Note: the directory index file is created in a temporary directory (usually somewhere below `target`) and than added to the build path internally.
# Maven configuration
```xml
com.helger.maven
ph-dirindex-maven-plugin
5.0.1
generate-dirindex
${basedir}/src/main/resources/
.*\.test
test-files
dirindex.xml
xml
```
Configuration items are:
* `File` **sourceDirectory**
The directory which should be indexed. This directory is mandatory to be specified. This directory is included in the resulting index file. No default present.
* `boolean` **recursive**
Should the source directory be scanned recursively for files?
Defaults to `true`
* `String` **dirnameRegEx** (since v4.0.4)
An optional regular expression to index only directory names that match this regular expression. If it is not specified, all directories are used.
* `boolean` **sourceChildrenOnly** (since v4.0.2)
Should the source directory itself be excluded from the listing? This only has an impact if recursive listing is enabled.
Defaults to `false`
* `String` **filenameRegEx**
An optional regular expression to index only files that match this regular expression. If it is not specified, all files are used.
* `File` **tempDirectory**
The directory where the temporary index file will be saved.
Default: `${project.build.directory}/dirindex-maven-plugin`
* `String` **targetDirectory**
The directory within the target artifact where the file should reside. This directory is relative to the `tempDirectory` and must not be provided. If this directory is not specified, than the created target file will reside by default in the root directory of the final artifact.
Default: *empty String*
* `String` **targetFilename**
The filename within the `tempDirectory` and the `targetDirectory` to be used. The resulting file will always be UTF-8 encoded.
Default: `dirindex.xml`
* `String` **outputFormat**
Defines the format of the result. Possible values are:
* `xml` - create XML output. This is the default value. Uses the UTF-8 character encoding.
* `text-name-only` (since 4.0.2) - creates simple text output with one line per directory and file. Uses LF (`\n`) as the line delimiter. Uses the UTF-8 character encoding.
# Output format
Example output for a `dirindex.xml` file (taken from the [ph-schematron](https://github.com/phax/ph-schematron/) project):
```xml
```
Explanation of the three elements:
* `index` - root element:
* `@sourcedirectory` the absolute source directory on disc that was scanned
* `@totaldirs` the overall number of directories contained (recursive)
* `@totalfiles` the overall number of files contained (recursive)
* `directory` - represents a single directory
* `@name` the full directory name relative to the starting directory
* `@basename` the name of the directory without any paths
* `@subdircount` the number of contained sub-directories (excluding `.` and `..`)
* `@filecount` the number of contained files in this directory (not recursive)
* `file` - represents a single file
* `@name` the full filename including the directories relative to the starting directory
* `@basename` the name of the file without any paths
* `@filesize` the size of the file in bytes
# News and noteworthy
v5.0.1 - 2025-11-16
* Updated to ph-commons 12.1.0
* Using JSpecify annotations
v5.0.0 - 2025-08-25
* Requires Java 17 as the minimum version
* Updated to ph-commons 12.0.0
v4.0.4 - 2025-02-06
* Avoid empty slash at the beginning of a list, if `sourceChildrenOnly` is `true`. See [#9](https://github.com/phax/ph-dirindex-maven-plugin/issues/9) - thx @reda-alaoui
* Added new configuration property `dirnameRegEx` that can control in what directories to descent in recursive mode
v4.0.3 - 2025-02-05
* If the property `sourceChildrenOnly` is used, the root path is not contained in the output. See [#8](https://github.com/phax/ph-dirindex-maven-plugin/issues/8) - thx @reda-alaoui
v4.0.2 - 2025-02-04
* Added new configuration property `sourceChildrenOnly` to omit the root directory from listing. See [#6](https://github.com/phax/ph-dirindex-maven-plugin/issues/6) - thx @reda-alaoui
* Added new configuration property `outputFormat` to be able to create different outputs. See [#7](https://github.com/phax/ph-dirindex-maven-plugin/issues/7) - thx @reda-alaoui
v4.0.1 - 2023-07-01
* Removed the `maven-compat` dependencies for Maven 4 compatibility
* Build against Maven 3.5.0
v4.0.0 - 2023-01-08
* Using Java 11 as the baseline
* Updated to ph-commons 11
v3.0.3 - 2021-03-22
* Updated to ph-commons 10
v3.0.2 - 2020-03-11
* Release with recent library versions
v3.0.1 - 2019-06-13
* Improved logging
* Using annotation based Maven configuration
v3.0.0 - 2018-08-06
* Updated to ph-commons 9.0.0
---
My personal [Coding Styleguide](https://github.com/phax/meta/blob/master/CodingStyleguide.md) |
It is appreciated if you star the GitHub project if you like it.