How can I select the output of maven dependency:list?

為{幸葍}努か 提交于 2020-05-14 09:07:06

问题


I have a big group of projects and they depend on each others with pom.xml. I want to get the relationships of these dependencies among projects in a file by shell. mvn dependency:list is the key command, but the result is not satisfied.

https://maven.apache.org/plugins/maven-dependency-plugin/list-mojo.html

with the guide, i have use some parameters, but the result is not good enough

now the command is:

mvn dependency:list -DincludeGroupIds=group -DoutputFile=dependency.xml -DappendOutput=true

and the result in dependency.xml is:

group:project1:jar:0.0.1-SNAPSHOT:compile

group:project2:jar:0.0.1-SNAPSHOT:compile

……

I want to select the output of mvn dependency:list with the format like that:

project1

project2

……

Just no jar, SNAPSHOT or complie words, which are unneeded.

So, I want to konw, how can I get the result output to a file in this format?

Can I just get this result by adding the parameters with mvn dependency:list?

Although sed or awk is an option.


回答1:


OK.

before i can repeat the guide from maven dependency plugin, i choose to use sed.

a man give me a word "post-processing step", nice word.

and my solution is :

sed -i "s/group://g" dependency.xml
sed -i "s/:jar:0.0.1-SNAPSHOT:compile//g" dependency.xml
sed -i "s/^[ \t]*//g" dependency.xml
sed -i "s/[ \t]*$//g" dependency.xml


来源:https://stackoverflow.com/questions/57214959/how-can-i-select-the-output-of-maven-dependencylist

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