We use AWS SAM to help local development of our java lambda functions. Rather than installing maven locally, I'd like to add maven to a AWS SAM Docker container and build within the container so I don't have my local env mixed up with dev env. The reason that out-of-box maven in those SAM containers do NOT work for us is we have custom maven central to point maven to.
I wrote a Dockerfile that essentially installs maven on top of
amazon/aws-sam-cli-emulation-image-java8
then copied my own settings.xml into the installed maven conf dir in the docker container. Used docker cli to check the cpy is successful, However, when I start 'sam build --user container', with container pointing to the container based on my Dockerfile, it is still using the default maven central repos, not my custom one.
Tried to look into sam's java maven work flow to find out any possible ways to custom maven, not sure there. Here is my question,
when we 'sam build --use-container' I understand the build takes place inside the container. But as what user and what paths are used are not clear to me. I tried turning on --debug for sam build. Not helpful. Searched in container for any settings.xml file and mvn dir and it seems there is only one which is what I want SAM to use. Thus I am pretty confused how could maven keep pointing to the default maven central rather than my own, ie, which maven is used in sam build --use-container
any hints/clues/tips are more than welcome. Thank you