Differing behavior in maven multi-module projects when run in TeamCity vs locally

I have a maven multi-module project.

In one of the child projects, in the <properties> section of its pom.xml I set "<target.env>dev</target.env>".

Later in the pom I use the properties-maven-plugin to load a file with the name "${target.env}.env.properties"

Locally if I run "mvn package -Dtarget.env=prod" in the parent project, the child project loads prod.env.properties as expected.

If I configure my teamcity build with param("system.target.env", "prod"), I can see "-Dtarget.env=prod" passed to the maven execution in the build log (where teamcity invokes the plexus-classworlds launcher to do so), the child project loads dev.env.properties, breaking the build.


Here's my questions:

  • Why does the behavior differ?
  • How do I reconcile this?

Please sign in to leave a comment.