File tree Expand file tree Collapse file tree
main/java/org/codehaus/gmavenplus/mojo
test/java/org/codehaus/gmavenplus/mojo Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 <groupId >org.codehaus.gmavenplus</groupId >
66 <artifactId >gmavenplus-plugin</artifactId >
77 <packaging >maven-plugin</packaging >
8- <version >1.14.0 -SNAPSHOT</version >
8+ <version >1.13.1 -SNAPSHOT</version >
99
1010 <properties >
1111 <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
Original file line number Diff line number Diff line change @@ -185,7 +185,9 @@ protected void initializeProperties() {
185185 properties .putAll (session .getUserProperties ());
186186 } else if (bindAllProjectProperties && bindSessionUserOverrideProperties && project != null ) {
187187 for (Object key : project .getProperties ().keySet ()) {
188- properties .put (key , session .getUserProperties ().get (key ));
188+ if (session .getUserProperties ().get (key ) != null ) {
189+ properties .put (key , session .getUserProperties ().get (key ));
190+ }
189191 }
190192 }
191193 }
Original file line number Diff line number Diff line change @@ -142,6 +142,20 @@ public void testAddAllSessionUserProperties() {
142142 assertEquals ("bar" , testMojo .properties .get ("foo" ));
143143 }
144144
145+ @ Test
146+ public void testBindAllProjectPropertiesAndBindSessionUserOverridePropertiesWhenEmpty () {
147+ MavenSession session = mock (MavenSession .class );
148+ Properties projectProperties = new Properties ();
149+ projectProperties .put ("foo" , "bar" );
150+ doReturn (new Properties ()).when (session ).getUserProperties ();
151+ doReturn (projectProperties ).when (project ).getProperties ();
152+ testMojo .session = session ;
153+ testMojo .bindAllProjectProperties = true ;
154+ testMojo .bindSessionUserOverrideProperties = true ;
155+
156+ testMojo .initializeProperties ();
157+ }
158+
145159 @ Test
146160 public void testSessionPropertiesOverrideProjectPropertiesAndIncludesOthers () {
147161 Properties projectProperties = new Properties ();
You can’t perform that action at this time.
0 commit comments