Substitution of properties in settings.xml does not work as you expected.
It will replace the properties inside the profile element (as you saw, it will replace your repository URL, which will be defined inside the profile), but not the elements outside the profiles (as you saw, the section happening in the mirrors). This distinction is made because the profile element in settings.xml is a truncated version of the pom.xml profile element. This is a mechanism that allows you to configure the configuration in POM, so property substitution is allowed in the profile elements, since they are actually part of the POM.
Parts of the settings outside the profile element represent the configuration of the platform, they should not be affected by individual assemblies, so they do not replace the properties of the command line. It makes sense, but nothing is really visible.
EDIT: in the mavens documentation settings page , in the last sentence of the quick look section (rather hidden), he states:
Please note that the properties defined in profiles in settings.xml cannot be used for interpolation.
However, there is a workaround, you can replace the environment variables with settings.xml. If you set the environment variable:
set M2_MIRROR=D:\test
and configure the repository URL as follows:
<url>file://${M2_MIRROR}/maven/.m2/repository</url>
Then call Maven as usual, replace the environment variable, and your build should work as needed.
Rich seller
source share