I have following pom.xml
<project>
<properties>
<buildNumber>dev</buildNumber>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}-${buildNumber}</finalName>
</build>
</project>
This works fine on development machine. If I run mvn package I’ve got project-1.1-dev.war artifact. If I run mvn package -DbuildNumber=121 I’ve got package-1.1-121.war.
But out CI server (TeamCity) always got project-1.1-dev.war despite the fact that buildNumber property passed to maven (if I remove default property definition from pom.xml, maven builds artifact with correct filename).
It seems that system property resolve priority is somehow depends on platform (maven version is equals on both developer machine and TC – 2.2.1)?
That’s a bit strange… Maybe you can’t force the parameter given in the command line to have a highest priority than the one defined in the
<properties>tag.An idea is to use a profile that define the property
buildNumber:So by default,
buildNumberwill be equals todevvalue. Now, in your TeamCity command line, disable this profile with the commandmvn ... -P !dev-property(the!before a profile id indicates that the profile must be disabled).