@@ -24,7 +24,12 @@ def is_project(self, document: Document) -> bool:
2424 return path .basename (document .path ).split ('/' )[- 1 ] == BUILD_MAVEN_FILE_NAME
2525
2626 def get_commands (self , manifest_file_path : str ) -> list [list [str ]]:
27- return [['mvn' , 'org.cyclonedx:cyclonedx-maven-plugin:2.7.4:makeAggregateBom' , '-f' , manifest_file_path ]]
27+ command = ['mvn' , 'org.cyclonedx:cyclonedx-maven-plugin:2.7.4:makeAggregateBom' , '-f' , manifest_file_path ]
28+
29+ maven_settings_file = self .ctx .obj .get ('maven_settings_file' )
30+ if maven_settings_file :
31+ command += ['-s' , str (maven_settings_file )]
32+ return [command ]
2833
2934 def get_lock_file_name (self ) -> str :
3035 return join_paths ('target' , MAVEN_CYCLONE_DEP_TREE_FILE_NAME )
@@ -46,7 +51,7 @@ def try_restore_dependencies(self, document: Document) -> Optional[Document]:
4651
4752 def restore_from_secondary_command (self , document : Document , manifest_file_path : str ) -> Optional [Document ]:
4853 restore_content = execute_commands (
49- commands = create_secondary_restore_commands (manifest_file_path ),
54+ commands = self . create_secondary_restore_commands (manifest_file_path ),
5055 timeout = self .command_timeout ,
5156 working_directory = self .get_working_directory (document ),
5257 )
@@ -61,10 +66,8 @@ def restore_from_secondary_command(self, document: Document, manifest_file_path:
6166 absolute_path = restore_file_path ,
6267 )
6368
64-
65- def create_secondary_restore_commands (manifest_file_path : str ) -> list [list [str ]]:
66- return [
67- [
69+ def create_secondary_restore_commands (self , manifest_file_path : str ) -> list [list [str ]]:
70+ command = [
6871 'mvn' ,
6972 'dependency:tree' ,
7073 '-B' ,
@@ -73,4 +76,9 @@ def create_secondary_restore_commands(manifest_file_path: str) -> list[list[str]
7376 manifest_file_path ,
7477 f'-DoutputFile={ MAVEN_DEP_TREE_FILE_NAME } ' ,
7578 ]
76- ]
79+
80+ maven_settings_file = self .ctx .obj .get ('maven_settings_file' )
81+ if maven_settings_file :
82+ command += ['-s' , str (maven_settings_file )]
83+
84+ return [command ]
0 commit comments