Placeholder with defaults syntax

43 views Asked by At

I have a port section in my maven file (docker-maven-plugin section) that looks like this:

<port>${webservice.adminport}:8080</port>

This works fine (uses webservice.adminport if it is defined or defaults to 8080).

However, I'm trying to use the same pattern in the env section of the pom:

<MY_ENV_VAR>http://${docker.host.address}:${webservice.adminport}:8080/my-service</MY_ENV_VAR>

but getting the following error, I think the syntax in the env section above is not correct?

Could not resolve placeholder 'webservice.adminport' in value "http://1.2.3.4:${webservice.adminport}:8080/my-service

1

There are 1 answers

1
rmf On

Found it:

<MY_ENV_VAR>http://${docker.host.address}:${webservice.adminport:8080}/my-service</MY_ENV_VAR>