0

Maven – Redirect console output to file

Sometimes when working with an IDE, all the console output are not displayed. This is normal as some IDEs are with default configuration to show only the last part of the overall output which still may consists of a few hundred lines. If the output is too huge, chances are, not all lines are displayed.

Command-line Parameter

In Apache Maven, we can redirect the console output a file when running the application itself using a specific command-line parameter. To do just that, we use the –log-file parameter. For example,

Path to file must exist

Tested with Apache Maven 3.3.9, the path to the file must be an existing path. Otherwise, the output is redirect to the console.

For more information, please visit https://maven.apache.org

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert