0

I've investigated how to get maven output logs automatically without passing any additional arguments. For example, to access the output log from a maven compile command, --log-file log.txt can be added after the maven command saving the log at a specific directory.

However, I'd like to know if there is a way to achieve such goal without explicitly adding arguments. If it is possible to add arguments in a configuration file, or even override the command behavior.

I searched for something like hooks for git, but I didn't find anything related. Could someone share any knowledge about it?

leuson
  • 11
  • 4
  • You might use `/.mvn/maven.config`? (See [Release notes starting with Maven 3.3.1](https://maven.apache.org/docs/3.3.1/release-notes.html)).. – khmarbaise May 18 '18 at 20:37
  • Thanks :) It works perfectly. – leuson May 21 '18 at 17:19
  • Despite the solution, the log is only available in the file disappearing from the terminal. I would like to keep both. I saw [this](https://stackoverflow.com/questions/39799178/send-maven-output-to-console-and-log-file-using-pom) but it doesn't work. – leuson May 21 '18 at 17:56
  • Have you tried to use `-l ...`? – khmarbaise May 22 '18 at 10:22
  • Yes, I have tried (_-l /{path}/log.log_). The problem is how to keep both logs available. – leuson May 22 '18 at 17:45
  • I find a way to solve [my problem](https://stackoverflow.com/questions/39799178/send-maven-output-to-console-and-log-file-using-pom/50687660#50687660). However, it works if maven is called by terminal; when called by IDEs, like eclipse, no output is saved. – leuson Jun 04 '18 at 19:42

0 Answers0