+ * For these given base directories, any intermediate directories created
+ * implicitly from {@code } elements are added to the package
+ * as explicit entries.
+ * The rules with file information are applied to these added directories as well.
+ *
+ * generateIntermediateDirectories;
+
/**
* The actual payload/file entries
*
@@ -1076,7 +1104,9 @@ protected void fillPayload(final RpmBuilder builder) throws MojoFailureException
return;
}
- final BuilderContext ctx = builder.newContext();
+ final ListenableBuilderContext ctx = new ListenableBuilderContext(builder.newContext());
+ final MissingDirectoryTracker missingDirectoryTracker = new MissingDirectoryTracker(this.generateIntermediateDirectories);
+ ctx.registerListener(missingDirectoryTracker);
this.logger.debug("Building payload:");
@@ -1091,6 +1121,11 @@ protected void fillPayload(final RpmBuilder builder) throws MojoFailureException
fillFromEntry(ctx, entry);
}
}
+
+ ctx.removeListener(missingDirectoryTracker);
+ if (!generateIntermediateDirectories.isEmpty()) {
+ missingDirectoryTracker.addMissingIntermediateDirectoriesToContext(ctx);
+ }
}
private void customizeHeader(final RpmBuilder builder) {
@@ -1133,7 +1168,6 @@ private void fillFromEntryFile(final BuilderContext ctx, final PackageEntry entr
this.logger.debug(" as file:");
final Path source = entry.getFile().toPath().toAbsolutePath();
this.logger.debug(" - source: %s", source);
-
ctx.addFile(entry.getName(), source, makeProvider(entry, " - "));
}
diff --git a/src/site/markdown/entry.md b/src/site/markdown/entry.md
index 5c8d64b..9b90de8 100644
--- a/src/site/markdown/entry.md
+++ b/src/site/markdown/entry.md
@@ -49,13 +49,16 @@ symbolic link points to. If this link to path is relative, then it is relative o
In order to walk through a directory tree and add all files use: `…`.
-The collect elements requires one additional element: `` which defines the base path. In addition
+The collect elements requires one additional element: `` which defines the base path. In addition,
there is the optional element ``, which can be set to `false` in order to not record
-directories explicitly. **Note:** the `` directory itself will never be added as explicit directory. This can be done using an additional `` element.
+directories explicitly. **Note:** the `` directory itself will never be added as explicit directory.
+This can be done using an additional `` element.
+Alternatively the general configuration for [generating intermediate directories](#generate-intermediate-directories)
+can be used to create intermediate directories when the package structure is built.
**Note:** By default symbolic links in the file system will be ignored. Since not all platforms support
-symbolic links in the same way. It is recommended to create the manually using a `` style
-entry. This behavior can be changed by changed by adding `true` to the
+symbolic links in the same way. It is recommended to create them manually using a `` style
+entry. This behavior can be changed by adding `true` to the
collector configuration.
The target file names will be constructed out the entry name, as base prefix, and the relative
@@ -87,7 +90,7 @@ Will result in the following payload entries:
/usr/lib/foo/dir2/foo3.txt (file)
/usr/lib/foo/dir2/foo4.txt (file)
-As of version 1.0.0 it is also possible to use the standard Maven `includes`/`excludes` elements
+As of version `1.0.0` it is also possible to use the standard Maven `includes`/`excludes` elements
which follow the standard Maven include/exclude pattern. For example:
@@ -144,3 +147,72 @@ In order to use explicit information use the following elements:
Also see [payload entry information](payload_information.html) for a full list.
+
+## Generate intermediate directories
+
+Since version `1.11.0` there is an option to automatically generate and add intermediate directories
+explicitly for all paths added by `` elements.
+Therefore, it is not necessary to manually configure each sub path to have it added explicitly to the package.
+
+To configure this optional function, a list of base paths must be specified by the configuration (TODO, ggf configuration streichen) property
+``.
+For these given base directories, any intermediate directories created implicitly from `` elements are added to the package
+as explicit entries.
+Sub paths of the base directories themselfs are not explicitly added to the package.
+
+**NOTE:** The [entry information](#entry-information) (explicit and ruleset) is applied to these intermediate directories as well.
+
+Example:
+
+
+ /usr/lib/foo
+ /some/other/basedirectory
+
+
+
+
+ /usr/lib/foo/bar/
+ path/to/file/foobar.txt
+
+
+
+Result:
+
+ /usr/lib/foo (dir - added by generateIntermediateDirectories)
+ /usr/lib/foo/bar (dir - added by generateIntermediateDirectories)
+ /usr/lib/foo/bar/foobar.txt (file - added by file entry)
+
+**Note**: In case of `` entries the feature of generating intermediate directories is only
+applied to directories outside of the collection.
+The behaviour of adding directories inside of `` is controlled independently by setting the
+`` flag (see [file system collector](#file-system-collector)).
+
+Collection Example:
+
+
+ /usr/lib/foo
+
+
+
+
+ /usr/lib/foo/bar
+
+ ${project.basedir}/src/main/data
+ ...
+
+
+
+
+Result with `true`:
+
+ /usr/lib/foo (dir - added by generateIntermediateDirectories)
+ /usr/lib/foo/bar (dir - added by generateIntermediateDirectories)
+ /usr/lib/foo/bar/x (dir - added by collect entry)
+ /usr/lib/foo/bar/x/y (dir - added by collect entry)
+ /usr/lib/foo/bar/x/y/foobar.txt (file - added by collect entry)
+
+Result with `false`:
+
+ /usr/lib/foo (dir - added by generateIntermediateDirectories)
+ /usr/lib/foo/bar (dir - added by generateIntermediateDirectories)
+ /usr/lib/foo/bar/x/y/foobar.txt (file - added by collect entry)