@@ -363,11 +363,11 @@ PreprocessorContext makePreprocessorContext() throws IOException {
363363
364364 if (this .project != null ) {
365365 final MavenPropertiesImporter mavenPropertiesImporter =
366- new MavenPropertiesImporter (context ,
367- this .project ,
368- this .session ,
369- isVerbose () || getLog ().isDebugEnabled ()
370- );
366+ new MavenPropertiesImporter (context ,
367+ this .project ,
368+ this .session ,
369+ isVerbose () || getLog ().isDebugEnabled ()
370+ );
371371 context .registerSpecialVariableProcessor (mavenPropertiesImporter );
372372 }
373373
@@ -405,12 +405,25 @@ PreprocessorContext makePreprocessorContext() throws IOException {
405405
406406 this .configFiles .forEach (x -> context .registerConfigFile (new File (x )));
407407
408- // process global vars
409- this .getVars ().forEach ((key , value ) -> {
410- getLog ().debug (String .format ("Register global var: '%s' <- '%s'" , key , value ));
411- context .setGlobalVariable (key , Value .recognizeRawString (value ));
412- });
413-
408+ // register global vars
409+ this .getVars ().entrySet ().stream ()
410+ .filter (e -> {
411+ final String key = e .getKey ();
412+ final String value = e .getValue ();
413+ if (value == null ) {
414+ getLog ().warn (String .format (
415+ "Global var '%s' ignored for null value (may be its content is empty in POM)" ,
416+ key ));
417+ return false ;
418+ } else {
419+ return true ;
420+ }
421+ })
422+ .forEach (e -> {
423+ getLog ().debug (
424+ String .format ("Register global var: '%s' <- '%s'" , e .getKey (), e .getValue ()));
425+ context .setGlobalVariable (e .getKey (), Value .recognizeRawString (e .getValue ()));
426+ });
414427 return context ;
415428 }
416429
0 commit comments