@@ -43,6 +43,7 @@ const (
4343 WORKSPACE_INIT_OPTION = "workspace"
4444 MVN_SETTINGS_FILE_INIT_OPTION = "mavenSettingsFile"
4545 GLOBAL_SETTINGS_INIT_OPTION = "mavenCacheDir"
46+ MVN_INSECURE_SETTING = "mavenInsecure"
4647 JVM_MAX_MEM_INIT_OPTION = "jvmMaxMem"
4748 FERN_FLOWER_INIT_OPTION = "fernFlowerPath"
4849)
@@ -253,6 +254,13 @@ func (p *javaProvider) Init(ctx context.Context, log logr.Logger, config provide
253254 }
254255 }
255256
257+ mavenInsecure , ok := config .ProviderSpecificConfig [MVN_INSECURE_SETTING ].(bool )
258+ if ok && mavenInsecure {
259+ log .Info ("maven insecure setting enabled" )
260+ } else {
261+ mavenInsecure = false
262+ }
263+
256264 lspServerPath , ok := config .ProviderSpecificConfig [provider .LspServerPathConfigKey ].(string )
257265 if ! ok || lspServerPath == "" {
258266 return nil , additionalBuiltinConfig , fmt .Errorf ("invalid lspServerPath provided, unable to init java provider" )
@@ -293,6 +301,9 @@ func (p *javaProvider) Init(ctx context.Context, log logr.Logger, config provide
293301 if mavenSettingsFile != "" {
294302 mvnOptions = append (mvnOptions , "-s" , mavenSettingsFile )
295303 }
304+ if mavenInsecure {
305+ mvnOptions = append (mvnOptions , "-Dmaven.wagon.http.ssl.insecure=true" )
306+ }
296307 log .Info ("downloading maven artifact" , "artifact" , mvnCoordinates , "options" , mvnOptions )
297308 cmd := exec .CommandContext (ctx , "mvn" , mvnOptions ... )
298309 cmd .Dir = outputDir
@@ -466,6 +477,7 @@ func (p *javaProvider) Init(ctx context.Context, log logr.Logger, config provide
466477 log : log ,
467478 depToLabels : map [string ]* depLabelItem {},
468479 isLocationBinary : isBinary ,
480+ mvnInsecure : mavenInsecure ,
469481 mvnSettingsFile : mavenSettingsFile ,
470482 globalSettings : globalSettingsFile ,
471483 depsLocationCache : make (map [string ]int ),
@@ -477,7 +489,7 @@ func (p *javaProvider) Init(ctx context.Context, log logr.Logger, config provide
477489 // we need to do this for jdtls to correctly recognize source attachment for dep
478490 switch svcClient .GetBuildTool () {
479491 case maven :
480- err := resolveSourcesJarsForMaven (ctx , log , fernflower , config .Location , mavenSettingsFile )
492+ err := resolveSourcesJarsForMaven (ctx , log , fernflower , config .Location , mavenSettingsFile , mavenInsecure )
481493 if err != nil {
482494 // TODO (pgaikwad): should we ignore this failure?
483495 log .Error (err , "failed to resolve maven sources jar for location" , "location" , config .Location )
@@ -753,7 +765,7 @@ func (j *javaProvider) GetLocation(ctx context.Context, dep konveyor.Dep, file s
753765
754766// resolveSourcesJarsForMaven for a given source code location, runs maven to find
755767// deps that don't have sources attached and decompiles them
756- func resolveSourcesJarsForMaven (ctx context.Context , log logr.Logger , fernflower , location , mavenSettings string ) error {
768+ func resolveSourcesJarsForMaven (ctx context.Context , log logr.Logger , fernflower , location , mavenSettings string , mvnInsecure bool ) error {
757769 // TODO (pgaikwad): when we move to external provider, inherit context from parent
758770 ctx , span := tracing .StartNewSpan (ctx , "resolve-sources" )
759771 defer span .End ()
@@ -771,6 +783,9 @@ func resolveSourcesJarsForMaven(ctx context.Context, log logr.Logger, fernflower
771783 if mavenSettings != "" {
772784 args = append (args , "-s" , mavenSettings )
773785 }
786+ if mvnInsecure {
787+ args = append (args , "-Dmaven.wagon.http.ssl.insecure=true" )
788+ }
774789 cmd := exec .CommandContext (ctx , "mvn" , args ... )
775790 cmd .Dir = location
776791 mvnOutput , err := cmd .CombinedOutput ()
0 commit comments