@@ -2567,7 +2567,7 @@ export function parseMavenTree(rawOutput, pomFile) {
25672567 const tmpA = rawOutput . split ( "\n" ) ;
25682568 let last_level = 0 ;
25692569 let last_purl = "" ;
2570- let first_purl = undefined ;
2570+ let first_ref = undefined ;
25712571 const stack = [ ] ;
25722572 tmpA . forEach ( ( l ) => {
25732573 l = l . replace ( "\r" , "" ) ;
@@ -2589,7 +2589,11 @@ export function parseMavenTree(rawOutput, pomFile) {
25892589 if ( pkgArr && pkgArr . length > 2 ) {
25902590 let versionStr = pkgArr [ pkgArr . length - 2 ] ;
25912591 const componentScope = pkgArr [ pkgArr . length - 1 ] ;
2592- if ( pkgArr . length >= 6 && pkgArr [ 3 ] !== versionStr ) {
2592+ if (
2593+ pkgArr . length >= 6 &&
2594+ pkgArr [ 3 ] !== versionStr &&
2595+ ! pkgArr [ 3 ] . includes ( ".jar" )
2596+ ) {
25932597 classifier = pkgArr [ 3 ] ;
25942598 }
25952599 // Ignore test scope
@@ -2619,9 +2623,10 @@ export function parseMavenTree(rawOutput, pomFile) {
26192623 qualifiers ,
26202624 null ,
26212625 ) . toString ( ) ;
2622- const key = purlString ;
2623- if ( ! first_purl ) {
2624- first_purl = purlString ;
2626+ const bomRef = decodeURIComponent ( purlString ) ;
2627+ const key = bomRef ;
2628+ if ( ! first_ref ) {
2629+ first_ref = bomRef ;
26252630 }
26262631 if ( ! keys_cache [ key ] ) {
26272632 keys_cache [ key ] = key ;
@@ -2640,7 +2645,7 @@ export function parseMavenTree(rawOutput, pomFile) {
26402645 scope,
26412646 properties,
26422647 purl : purlString ,
2643- "bom-ref" : decodeURIComponent ( purlString ) ,
2648+ "bom-ref" : bomRef ,
26442649 } ;
26452650 if ( pomFile ) {
26462651 properties . push ( {
@@ -2662,32 +2667,32 @@ export function parseMavenTree(rawOutput, pomFile) {
26622667 } ;
26632668 }
26642669 deps . push ( apkg ) ;
2665- if ( ! level_trees [ purlString ] ) {
2666- level_trees [ purlString ] = [ ] ;
2670+ if ( ! level_trees [ bomRef ] ) {
2671+ level_trees [ bomRef ] = [ ] ;
26672672 }
26682673 if ( level === 0 || last_purl === "" ) {
2669- stack . push ( purlString ) ;
2674+ stack . push ( bomRef ) ;
26702675 } else if ( level > last_level ) {
26712676 const cnodes = level_trees [ last_purl ] || [ ] ;
2672- cnodes . push ( purlString ) ;
2677+ cnodes . push ( bomRef ) ;
26732678 level_trees [ last_purl ] = cnodes ;
2674- if ( stack [ stack . length - 1 ] !== purlString ) {
2675- stack . push ( purlString ) ;
2679+ if ( stack [ stack . length - 1 ] !== bomRef ) {
2680+ stack . push ( bomRef ) ;
26762681 }
26772682 } else {
26782683 for ( let i = level ; i <= last_level ; i ++ ) {
26792684 stack . pop ( ) ;
26802685 }
26812686 const last_stack = stack . length
26822687 ? stack [ stack . length - 1 ]
2683- : first_purl ;
2688+ : first_ref ;
26842689 const cnodes = level_trees [ last_stack ] || [ ] ;
2685- cnodes . push ( purlString ) ;
2690+ cnodes . push ( bomRef ) ;
26862691 level_trees [ last_stack ] = cnodes ;
2687- stack . push ( purlString ) ;
2692+ stack . push ( bomRef ) ;
26882693 }
26892694 last_level = level ;
2690- last_purl = purlString ;
2695+ last_purl = bomRef ;
26912696 }
26922697 }
26932698 }
0 commit comments