@@ -27,12 +27,12 @@ public ModuleDescriptor parse(InputStream stream) throws IOException {
27
27
if (jsonObject .has ("parent" )) {
28
28
JSONObject parentObject = jsonObject .getJSONObject ("parent" );
29
29
// No packaging type is allowed on <parent> tag
30
- parent = getGav (parentObject , null );
30
+ parent = getGav (parentObject , null , null );
31
31
} else {
32
32
parent = null ;
33
33
}
34
34
// Packaging is defined with <packaging> tag on artefact definition
35
- GAV gav = getGav (jsonObject , "packaging" );
35
+ GAV gav = getGav (jsonObject , "packaging" , parent );
36
36
String packaging = jsonObject .has ("packaging" ) ? jsonObject .getString ("packaging" ) : "jar" ;
37
37
38
38
Map <String , String > properties = new LinkedHashMap <>();
@@ -64,20 +64,20 @@ public ModuleDescriptor parse(InputStream stream) throws IOException {
64
64
}
65
65
66
66
// Packaging is defined with <type> tag on dependencies
67
- scopeDependencies .add (new ModuleDependency (getGav (dep , "type" )));
67
+ scopeDependencies .add (new ModuleDependency (getGav (dep , "type" , null )));
68
68
}
69
69
}
70
70
71
71
return new ModuleDescriptor (parent , gav , packaging ,
72
72
properties , new HashMap <String ,List <ModuleFragment >>(), dependencies );
73
73
}
74
74
75
- private GAV getGav (JSONObject jsonObject , String typeKey ) {
75
+ private GAV getGav (JSONObject jsonObject , String typeKey , GAV parentGAV ) {
76
76
return new GAV (
77
- jsonObject .getString ("groupId" ),
78
- jsonObject .getString ("artifactId" ),
79
- String .valueOf (jsonObject .get ("version" )),
80
- typeKey ==null ?null :jsonObject .has (typeKey )?jsonObject .getString (typeKey ):null ,
77
+ jsonObject .has ( "groupId" )? jsonObject . getString ("groupId" ): parentGAV == null ? null : parentGAV . getGroupId ( ),
78
+ jsonObject .has ( "artifactId" )? jsonObject . getString ("artifactId" ): parentGAV == null ? null : parentGAV . getArtifactId ( ),
79
+ jsonObject . has ( "version" )? String .valueOf (jsonObject .get ("version" )): parentGAV == null ? null : parentGAV . getVersion ( ),
80
+ typeKey ==null ?null :jsonObject .has (typeKey )?jsonObject .getString (typeKey ):parentGAV == null ? null : parentGAV . getType () ,
81
81
jsonObject .has ("classifier" )?jsonObject .getString ("classifier" ):null ,
82
82
jsonObject .has ("optional" )?jsonObject .getBoolean ("optional" ):false );
83
83
}
0 commit comments