Title: Maven ignoring local repository location changes
Tags: java;maven;repository;settings;quarkus
Question: Im trying to change the location of Mavens local repository, but it didnt work for me so far.
Im currently doing the tutorial of quarkus: https://quarkus.io/guides/getting-started
I changed the localRepository setting in the settings.xml to
<localRepository&gt;D:\Zubehoer\Maven\repository</localRepository&gt;
and also copied that settings.xml to the .m2 folder in my user home.
When I do mvn compile quarkus:dev as shown in linked tutorial the dependencys get downloaded to the default repository instead of the location I changed the local repository to.
Lastly the pom of the project:
<project xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot; xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
<modelVersion&gt;4.0.0</modelVersion&gt;
<groupId&gt;org.acme</groupId&gt;
<artifactId&gt;getting-started</artifactId&gt;
<version&gt;1.0-SNAPSHOT</version&gt;
<properties&gt;
<compiler-plugin.version&gt;3.8.1</compiler-plugin.version&gt;
<maven.compiler.parameters&gt;true</maven.compiler.parameters&gt;
<maven.compiler.source&gt;1.8</maven.compiler.source&gt;
<maven.compiler.target&gt;1.8</maven.compiler.target&gt;
<project.build.sourceEncoding&gt;UTF-8</project.build.sourceEncoding&gt;
<project.reporting.outputEncoding&gt;UTF-8</project.reporting.outputEncoding&gt;
<quarkus-plugin.version&gt;1.5.2.Final</quarkus-plugin.version&gt;
<quarkus.platform.artifact-id&gt;quarkus-universe-bom</quarkus.platform.artifact-id&gt;
<quarkus.platform.group-id&gt;io.quarkus</quarkus.platform.group-id&gt;
<quarkus.platform.version&gt;1.5.2.Final</quarkus.platform.version&gt;
<surefire-plugin.version&gt;2.22.1</surefire-plugin.version&gt;
</properties&gt;
<dependencyManagement&gt;
<dependencies&gt;
<dependency&gt;
<groupId&gt;${quarkus.platform.group-id}</groupId&gt;
<artifactId&gt;${quarkus.platform.artifact-id}</artifactId&gt;
<version&gt;${quarkus.platform.version}</version&gt;
<type&gt;pom</type&gt;
<scope&gt;import</scope&gt;
</dependency&gt;
</dependencies&gt;
</dependencyManagement&gt;
<dependencies&gt;
<dependency&gt;
<groupId&gt;io.quarkus</groupId&gt;
<artifactId&gt;quarkus-resteasy</artifactId&gt;
</dependency&gt;
<dependency&gt;
<groupId&gt;io.quarkus</groupId&gt;
<artifactId&gt;quarkus-junit5</artifactId&gt;
<scope&gt;test</scope&gt;
</dependency&gt;
<dependency&gt;
<groupId&gt;io.rest-assured</groupId&gt;
<artifactId&gt;rest-assured</artifactId&gt;
<scope&gt;test</scope&gt;
</dependency&gt;
</dependencies&gt;
<build&gt;
<plugins&gt;
<plugin&gt;
<groupId&gt;io.quarkus</groupId&gt;
<artifactId&gt;quarkus-maven-plugin</artifactId&gt;
<version&gt;${quarkus-plugin.version}</version&gt;
<executions&gt;
<execution&gt;
<goals&gt;
<goal&gt;build</goal&gt;
</goals&gt;
</execution&gt;
</executions&gt;
</plugin&gt;
<plugin&gt;
<artifactId&gt;maven-compiler-plugin</artifactId&gt;
<version&gt;${compiler-plugin.version}</version&gt;
</plugin&gt;
<plugin&gt;
<artifactId&gt;maven-surefire-plugin</artifactId&gt;
<version&gt;${surefire-plugin.version}</version&gt;
<configuration&gt;
<systemPropertyVariables&gt;
<java.util.logging.manager&gt;org.jboss.logmanager.LogManager</java.util.logging.manager&gt;
</systemPropertyVariables&gt;
</configuration&gt;
</plugin&gt;
</plugins&gt;
</build&gt;
<profiles&gt;
<profile&gt;
<id&gt;native</id&gt;
<activation&gt;
<property&gt;
<name&gt;native</name&gt;
</property&gt;
</activation&gt;
<build&gt;
<plugins&gt;
<plugin&gt;
<artifactId&gt;maven-failsafe-plugin</artifactId&gt;
<version&gt;${surefire-plugin.version}</version&gt;
<executions&gt;
<execution&gt;
<goals&gt;
<goal&gt;integration-test</goal&gt;
<goal&gt;verify</goal&gt;
</goals&gt;
<configuration&gt;
<systemPropertyVariables&gt;
<native.image.path&gt;${project.build.directory}/${project.build.finalName}-runner</native.image.path&gt;
</systemPropertyVariables&gt;
</configuration&gt;
</execution&gt;
</executions&gt;
</plugin&gt;
</plugins&gt;
</build&gt;
<properties&gt;
<quarkus.package.type&gt;native</quarkus.package.type&gt;
</properties&gt;
</profile&gt;
</profiles&gt;
</project&gt;
Relevenat image of  maven debug output
Comment: Do you see the same issue with `mvn package -DskipTests`?

Comment: In that case, it looks like a Maven config issue. Have you tried building non-Quarkus project with these settings?

Comment: Maven probably isn't looking at the right settings file. Can you start it with the debug option (`-X`) and check the first few lines of the output? Can you also check you haven't got a *duplicate* `localRepository` tag in the corresponding settings file?

Comment: @goldarm5 Further sanity check, does `mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout` definitely print out the wrong local repository?

Comment: @goldarm5 That's bizarre. Last thing I can think of to check is that your `localRepository` tag is definitely at the top level (well just under ``) and not inside another tag. You could temporarily just try changing the file contents to "D:\Zubehoer\Maven\repository" to see if it picks it up.

Comment: @goldarm5 That definitely gets a ‍♂️ emoji...

Comment: which IDE are you using ?

Comment: Eclipse, but I didnt use the eclipse-maven. Everything I have done was done with the standalone maven.

Comment: @AlexeyLoubyansky same, with ```mvn package -Dskiptests```

Comment: @MichaelBerry I added an image of the debug output in my post. I checked both settings.xml files and both only contained 1 localRepository property. The value of those as said in the original post is ```D:\Zubehoer\Maven\repository```

Comment: @AlexeyLoubyansky its the same for another non quarkus project

Comment: @MichaelBerry that prints C:\Users\Admin\.m2\repository

Comment: @MichaelBerry I think Ive got the problem, and as one would exspect its a pretty simple one in the end I think. I didnt exactly realize that by default the localRepository property is inside a comment, and the view in WordPad doesnt really highlight this. I just ctrl + f searched for localRepos and changed the value inside `````` . Makes sense it doesnt work if thats inside a comment...

Here is the accepted answer: So by default the <localRepository&gt;</localRepository&gt; property of mavens settings.xml is inside a comment:
<!-- localRepository** | The path to the local repository maven will use to store artifacts. | | Default: ${user.home}/.m2/repository <localRepository&gt;/path/to/local/repo</localRepository&gt; --&gt;
As I only changed the value of the localRepository property, but did not move the property outside of the comment it didnt work.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 13, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:06/30/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<java><maven><repository><settings><quarkus>', 'Title': 'Maven ignoring local repository location changes', 'ViewCount': 555, 'id': 62658042, 'user_AboutMe': None, 'user_AccountId': 12370191.0, 'user_DisplayName': 'goldarm5', 'user_Reputation': 29.0, 'user_Views': 10.0, 'user_id': 9020730.0}}