问题
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