[英]How to parse a build.gradle file in java?
I need to parse the gradle build.gradle file in Java and list out all its dependencies(as List of Group:Artifact:Version) mentioned under dependencies block.我需要解析 Java 中的 gradle build.gradle 文件,并列出其所有依赖项(如 List of Group:Artifact:Version )在依赖项块下提到。
What would be the best possible solution for this?什么是最好的解决方案?
build.gradle like below, build.gradle 如下所示,
apply plugin: 'java-library'
repositories {
jcenter()
}
dependencies {
compileOnly group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.25'
compile group: 'com.google.code.findbugs', name: 'annotations' , version: '3.0.0'
compile "com.google.code.gson:gson:2.8.5"
compile "org.owasp:dependency-check-gradle:4.0.1"
compile 'org.apache.httpcomponents:httpclient:4.5.7'
api 'org.apache.commons:commons-math3:3.6.1'
implementation 'com.google.guava:guava:21.0'
testImplementation 'junit:junit:4.12'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.