Skip to content

Commit 9ccad24

Browse files
committed
fix: Error of getting dependencies #7
Fix error `the return value of "org.apache.maven.model.Model.getDependencyManagement()" is null`
1 parent acf30f2 commit 9ccad24

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/main/kotlin/org/skgroup/securityinspector/utils/Decompiler.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,19 @@ class Decompiler(private val project: Project) {
2828
mavenReader.read(reader)
2929
}
3030

31-
val dependencies1 = model.dependencies
31+
var dependencies: MutableList<Dependency> = mutableListOf()
3232

33-
val dependencies2 = model.dependencyManagement.dependencies
33+
try {
34+
dependencies += model.dependencies
35+
} catch (e: Exception) {
36+
println("Dependencies from pom.xml not found")
37+
}
3438

35-
var dependencies = dependencies1 + dependencies2
39+
try {
40+
dependencies += model.dependencyManagement.dependencies
41+
} catch (e: Exception) {
42+
println("DependencyManagement dependencies of pom.xml not found")
43+
}
3644

3745
//需要考虑moudle嵌套的情况
3846
dependencies = resolveModules(projectBaseDir, model, dependencies as ArrayList<Dependency>)

0 commit comments

Comments
 (0)