Avoiding ~/.m2 when publishing Android library artifacts to file destination

I’m trying to configure my Android library project to upload artifacts to a maven repository in a custom file location in the build workstation.

I have a preference to use the ‘maven’ plug-in since it seems to be the most stable and official one to use.

After trying a few things, the only working configuration I found was to use the mavenDeployer configuration, like so:

allprojects {
  uploadArchives {
    repositories {
      mavenDeployer {
        repository (url: 'file:///my/custom/location')

What I noticed is that whenever I deploy an artifact using this configuration, even if I don’t have a maven local instance configured, a copy of the artifact always ends up in ~/.m2.

It is important to me that ~/.m2 isn’t used - I need to make sure I only make changes within a given subdirectory structure.

I tried configuring the localRepository location in ~/.m2/settings.xml but that seems to be ignored by mavenDeployer.

I tried changing mavenDeployer to mavenInstaller and confirmed that the configuration in settings.xml is used then - but the resulting artifact POMs aren’t produced properly: they are missing the dependencies section, which is also very important to me.

So my conclusion is that mavenDeployer is ignoring the maven local configuration and it is further impossible to configure it skip deploying to maven local.

Am I missing anything with this?