This topic tells you how to resolve conflicts that Application Accelerator transforms in Tanzu Application Platform (commonly known as TAP) might produce.
For example, if you're using Merge (or Combo's merge
syntax) or
RewritePath, a transform can produce several files at the same path
.
The engine then must take an action: Should it keep the last file?
Report an error? Concatenate the files together?
Such conflicts can arise for a number of reasons. You can avoid or resolve them by configuring transforms with a conflict resolution. For example:
- Combo uses UseLast by default, but you can configure it to do otherwise.
- You can explicitly end a transform Chain with a UniquePath, which by default uses Fail. This is customizable.
type: Combo # often omitted
merge:
- <transform>
chain:
- <transform>
- ...
onConflict: <conflict resolution> # defaults to 'UseLast'
type: Chain # or implicitly using Combo
transformations:
- <transform>
- <transform>
- type: UniquePath
strategy: <conflict resolution> # defaults to 'Fail'
The following values and behaviors are available:
Fail
: Stop processing on the first file that exhibitspath
conflicts.UseFirst
: For each conflicting file, the file produced first (typically by a transform appearing earlier in the YAML definition) is retained.UseLast
: For each conflicting file, the file produced last (typically by a transform appearing later in the YAML definition) is retained.Append
: The conflicting versions of files are concatenated (as if usingcat file1 file2 ...
), with files produced first appearing first.FavorOwn
: Only makes sense in the context of composition. Selects the version of the file that comes from the current executing fragment if possible, falls back to the caller version otherwise.FavorForeign
: Only makes sense in the context of composition. Selects the version of the file that was provided by the caller if present, falls back to the file originating from this fragment's fileset otherwise.