File tree Expand file tree Collapse file tree 2 files changed +25
-10
lines changed
Expand file tree Collapse file tree 2 files changed +25
-10
lines changed Original file line number Diff line number Diff line change @@ -576,16 +576,17 @@ def get_pom_url_list(input_source, packages):
576576 pom_url_list = []
577577 if packages :
578578 for package in packages :
579- package_ns = package .get ("namespace" , "" )
580- package_name = package .get ("name" , "" )
581- package_version = package .get ("version" , "" )
582- pom_url = (
583- f"https://repo1.maven.org/maven2/{ package_ns .replace ('.' , '/' )} /"
584- f"{ package_name } /{ package_version } /"
585- f"{ package_name } -{ package_version } .pom" .lower ()
586- )
587- pom_url_list .append (pom_url )
588- else :
579+ if package .get ("type" ) == "maven" :
580+ package_ns = package .get ("namespace" , "" )
581+ package_name = package .get ("name" , "" )
582+ package_version = package .get ("version" , "" )
583+ pom_url = (
584+ f"https://repo1.maven.org/maven2/{ package_ns .replace ('.' , '/' )} /"
585+ f"{ package_name } /{ package_version } /"
586+ f"{ package_name } -{ package_version } .pom" .lower ()
587+ )
588+ pom_url_list .append (pom_url )
589+ if not pom_url_list :
589590 from urllib .parse import urlparse
590591
591592 # Check what's the input source
Original file line number Diff line number Diff line change @@ -548,6 +548,7 @@ def test_scanpipe_resolve_construct_pom_url_from_filename(
548548 def test_scanpipe_resolve_get_pom_url_list_with_packages (self ):
549549 packages = [
550550 {
551+ "type" : "maven" ,
551552 "namespace" : "org.apache.commons" ,
552553 "name" : "commons-lang3" ,
553554 "version" : "3.12.0" ,
@@ -559,6 +560,19 @@ def test_scanpipe_resolve_get_pom_url_list_with_packages(self):
559560 ]
560561 self .assertEqual (result , expected )
561562
563+ def test_scanpipe_resolve_get_pom_url_list_with_non_maven_packages (self ):
564+ packages = [
565+ {
566+ "type" : "jar" ,
567+ "namespace" : "" ,
568+ "name" : "spring-context" ,
569+ "version" : "7.0.0" ,
570+ }
571+ ]
572+ result = resolve .get_pom_url_list ({}, packages )
573+ expected = []
574+ self .assertEqual (result , expected )
575+
562576 def test_scanpipe_resolve_get_pom_url_list_with_maven_download_url (self ):
563577 input_source = {
564578 "download_url" : "https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar"
You can’t perform that action at this time.
0 commit comments