com.xxx.xxx:xxx:jar:0.2.4.RELEASE
+- org.projectlombok:lombok:jar:1.16.18:compile
+- org.springframework.cloud:spring-cloud-starter-feign:jar:1.3.5.RELEASE:compile
| +- org.springframework.cloud:spring-cloud-starter:jar:1.2.4.RELEASE:compile
| | +- org.springframework.cloud:spring-cloud-context:jar:1.2.4.RELEASE:compile
| | \- org.springframework.security:spring-security-rsa:jar:1.0.3.RELEASE:compile
| | \- org.bouncycastle:bcpkix-jdk15on:jar:1.55:compile
| | \- org.bouncycastle:bcprov-jdk15on:jar:1.55:compile
| +- org.springframework.cloud:spring-cloud-netflix-core:jar:1.3.5.RELEASE:compile
| | +- org.springframework.boot:spring-boot:jar:1.5.9.RELEASE:compile
| | \- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.9.RELEASE:compile
| +- org.springframework:spring-web:jar:4.3.13.RELEASE:compile
| | +- org.springframework:spring-aop:jar:4.3.13.RELEASE:compile
| | +- org.springframework:spring-beans:jar:4.3.13.RELEASE:compile
| | \- org.springframework:spring-context:jar:4.3.13.RELEASE:compile
| | \- org.springframework:spring-expression:jar:4.3.13.RELEASE:compile
| +- org.springframework.cloud:spring-cloud-commons:jar:1.2.4.RELEASE:compile
| | \- org.springframework.security:spring-security-crypto:jar:4.2.3.RELEASE:compile
| +- io.github.openfeign:feign-core:jar:9.5.0:compile
| | \- org.jvnet:animal-sniffer-annotation:jar:1.0:compile
| +- io.github.openfeign:feign-slf4j:jar:9.5.0:compile
| | \- org.slf4j:slf4j-api:jar:1.7.25:compile
| +- io.github.openfeign:feign-hystrix:jar:9.5.0:compile
| | +- com.netflix.archaius:archaius-core:jar:0.6.6:compile
| | | \- com.google.code.findbugs:annotations:jar:2.0.0:runtime
| | \- com.netflix.hystrix:hystrix-core:jar:1.4.26:compile
| +- org.springframework.cloud:spring-cloud-starter-ribbon:jar:1.3.5.RELEASE:compile
| | +- com.netflix.ribbon:ribbon:jar:2.2.2:compile
| | | +- com.netflix.ribbon:ribbon-transport:jar:2.2.2:runtime
| | | | +- io.reactivex:rxnetty-contexts:jar:0.4.
...
上面为dependency:tree -DoutputFile=hello -DoutputType=text
的结果,如果希望使用Java
代码解析上述的信息,可以参考一下内容
<dependency>
<groupId>org.whitesource</groupId>
<artifactId>maven-dependency-tree-parser</artifactId>
<version>1.0.5</version>
</dependency>
Java
代码
//file 为 dependency:tree -DoutputFile=hello -DoutputType=text 结果所在的文件(hello为文件名)
FileInputStream fis = new FileInputStream(new File(file))
Reader reader = new BufferedReader(new InputStreamReader(fis));
InputType type = InputType.TEXT;
Parser parser = type.newParser();
Node node = parser.parse(reader);
详情见 https://github.com/adutra/maven-dependency-tree-parser
使用Java
代码执行maven
命令,可参考文章 https://blog.csdn.net/sweatOtt/article/details/85294488
使用Java
代码解析pom.xml
内容,可参考文章 https://blog.csdn.net/sweatOtt/article/details/85294408