You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configuration/merging/README.md
+18-5Lines changed: 18 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,21 +77,33 @@ Different strategies will lead to different results for `foo/bar` files in the J
77
77
```
78
78
79
79
The [`ResourceTransformer`][ResourceTransformer]s like [`ServiceFileTransformer`][ServiceFileTransformer] will not work
80
-
as expected as the duplicate resource files fed for them are excluded beforehand. However, this behavior might be what you expected for duplicate `foo/bar` files, preventing them from being included.
80
+
as expected as the duplicate resource files fed for them are excluded beforehand. However, this behavior might be what
81
+
you expected for duplicate `foo/bar` files, preventing them from being included.
81
82
82
-
Want [`ResourceTransformer`][ResourceTransformer]s and `duplicatesStrategy` to work together? There are several steps
83
-
to take:
83
+
Want [`ResourceTransformer`][ResourceTransformer]s and `duplicatesStrategy` to work together? There are several common
84
+
steps to take:
84
85
85
-
1. Set the strategy to `INCLUDE` or `WARN`.
86
+
1. Set the default strategy to `INCLUDE` or `WARN`.
86
87
2. Apply your [`ResourceTransformer`][ResourceTransformer]s.
87
88
3. Remove duplicate entries by
88
-
- overriding the default strategy for specific files using [`filesMatching`][Jar.filesMatching] or [`eachFile`][Jar.eachFile] functions
89
+
- overriding the default strategy for specific files to `EXCLUDE` or `FAIL` using
90
+
[`filesMatching`][Jar.filesMatching], [`filesNotMatching`][Jar.filesNotMatching], or [`eachFile`][Jar.eachFile] functions
89
91
- or applying [`PreserveFirstFoundResourceTransformer`][PreserveFirstFoundResourceTransformer] for specific files
90
92
- or write your own [`ResourceTransformer`][ResourceTransformer] to handle duplicates
91
93
- or mechanism similar.
92
94
4. Optionally, enable [`ShadowJar.failOnDuplicateEntries`][ShadowJar.failOnDuplicateEntries] to check duplicate entries in the final JAR.
93
95
5. Optionally, use [Diffuse](https://github.com/JakeWharton/diffuse) to diff the JARs.
94
96
97
+
or the steps like:
98
+
99
+
1. Set the default strategy to `EXCLUDE` or `FAIL`.
100
+
2. Apply your [`ResourceTransformer`][ResourceTransformer]s.
101
+
3. Bypass the duplicate entries which should be handled by the [`ResourceTransformer`][ResourceTransformer]s using
102
+
[`filesMatching`][Jar.filesMatching], [`filesNotMatching`][Jar.filesNotMatching], or [`eachFile`][Jar.eachFile] functions
103
+
to set their `duplicatesStrategy` to `INCLUDE` or `WARN`.
104
+
4. Optionally, enable [`ShadowJar.failOnDuplicateEntries`][ShadowJar.failOnDuplicateEntries] to check duplicate entries in the final JAR.
105
+
5. Optionally, use [Diffuse](https://github.com/JakeWharton/diffuse) to diff the JARs.
106
+
95
107
## Basic ResourceTransformer Usage
96
108
97
109
For simpler use cases, you can create a basic transformer:
@@ -453,6 +465,7 @@ It must be added using the [`transform`][ShadowJar.transform] methods.
0 commit comments