apache / apache/maven-filtering
Logging: destination path missing when destination equals basedir in DefaultMavenResourcesFiltering
- Dominant language
- Java
- Stars
- 9
- Forks
- 36
- Avg merge
- 8h 47m
- Merged PRs (30d)
- 4
Description
### Affected version
3.x
### Bug description
When `DefaultMavenResourcesFiltering.filterResources()` logs copy operations it uses `Path.relativize` against the project's base directory. If the destination path equals `basedir` (i.e. copy to the basedir directory), `basedir.relativize(destination)` returns an empty string, so the log message ends with "to ".
For example: "Copying 1 resource from sourcedir to ".
Current code:
```java
LOGGER.info("Copying " + includedFiles.size() + " resource" + (includedFiles.size() > 1 ? "s" : "")
+ " from "
+ basedir.relativize(resourceDirectory.toAbsolutePath())
+ " to "
+ basedir.relativize(destination));
```
The log message should show the destination path:
- "." or
- the absolute path or
- "basedir" / "project base directory"
Suggested code change:
```java
LOGGER.info("Copying " + includedFiles.size() + " resource" + (includedFiles.size() > 1 ? "s" : "")
+ " from "
+ basedir.relativize(resourceDirectory.toAbsolutePath())
+ " to "
+ (basedir.equals(destination) ? "." : basedir.relativize(destination)));
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.