cargo-maven2-plugin - blank property value in container systemProperties causes NullPointerException


Consider the following POM fragment:


When included in a build, an exception is thrown if ${maven.some.systemProperty} is blank:

Caused by: java.lang.NullPointerException
at java.util.Hashtable.put(
at java.util.Properties.setProperty(
at java.lang.System.setProperty(
at org.codehaus.cargo.maven2.configuration.Container.setupEmbeddedSystemProperties(
at org.codehaus.cargo.maven2.configuration.Container.createContainer(
at org.codehaus.cargo.maven2.AbstractCargoMojo.createNewContainer(
at org.codehaus.cargo.maven2.AbstractCargoMojo.createContainer(
at org.codehaus.cargo.maven2.ContainerStartMojo.doExecute(
at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(

Of course, one could argue why include the system property in the POM if it's blank. I am wanting to use such functionality as a means of including a runtime "override" to a default value in the WAR being deployed - code in my WAR reads in the system property and uses it as an override only if it is not null; otherwise the default value defined in the WAR is used instead.

Looking at the stack trace a simple check for null in org.codehaus.cargo.maven2.configuration.Container.setupEmbeddedSystemProperties should solve the problem - if the value is null just don't define the system property.

I'll take a look at pulling a patch together later when I get a spare moment.


Savas Ali Tokmen


Alistair Dutton


Fix versions

Affects versions