如何选择MavenDependency:list的输出? [英] How can I select the output of maven dependency:list?
问题描述
我有很多项目,并且它们与pom.xml
相互依赖.
我想通过shell获取文件中项目之间这些依赖关系的关系. mvn dependency:list
是键盘命令,但结果不令人满意.
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
现在的命令是:
mvn dependency:list -DincludeGroupIds=group -DoutputFile=dependency.xml -DappendOutput=true
, dependency.xml 中的结果是:
and the result in dependency.xml is:
group:project1:jar:0.0.1-SNAPSHOT:compile
group:project2:jar:0.0.1-SNAPSHOT:compile
……
我想选择mvn dependency:list
的输出,格式如下:
I want to select the output of mvn dependency:list
with the format like that:
project1
project2
……
只需不需要jar
,SNAPSHOT
或complie
单词.
所以,我想知道,如何将结果输出以这种格式保存到文件中?
So, I want to konw, how can I get the result output to a file in this format?
我可以通过在mvn dependency:list
中添加参数来获得此结果吗?
Can I just get this result by adding the parameters with mvn dependency:list
?
尽管可以选择sed
或awk
.
推荐答案
确定.
在我可以重复使用maven dependency plugin
中的指南之前,我选择使用sed
.
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.
我的解决方法是:
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
这篇关于如何选择MavenDependency:list的输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!