Send maven output to file

让人想犯罪 __ 提交于 2019-12-03 04:43:00

问题


On Windows 7, I am trying to send the output of a maven-3 command to a text file.

I call the command from the root of the project I am trying to analyze.

The command is:

mvn dependency:tree -Dverbose -Dincludes=commons-collections -DoutputFile=C:\Users\myname\Documents\output.txt

When I run the command without the outputFile parameter, I see the output sent to the console.

But when I use it with the outputFile parameter, the output file is empty.

Any idea what I am missing here?


回答1:


Try mvn -help

 -l,--log-file <arg>  Log file to where all build output will go.                               

mvn <your parameters> --log-file log.txt




回答2:


Just give it a try:

mvn dependency:tree -Dverbose -DoutputFile=resout.out

within the same folder where the pom file is located.




回答3:


We can use like : Go to the Project directory and run the below maven command and the output will display in log.txt file.

mvn clean install --log-file log.txt




回答4:


Old school, but it's what I knew. One caveat is that the mvn command does not return when done to the cli, but for some purposes this is acceptable.

mvn "-Dexec.args=-classpath %classpath com.mycompany.test" -Dexec.executable=/Downloads/jdk1.7/bin/java exec-maven-plugin:1.2.1:exec > /tmp/Out



来源:https://stackoverflow.com/questions/9726875/send-maven-output-to-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!