简体   繁体   English

Maven 忽略本地存储库位置更改

[英]Maven ignoring local repository location changes

Im trying to change the location of Mavens local repository, but it didnt work for me so far.我试图更改 Maven 本地存储库的位置,但到目前为止它对我不起作用。 Im currently doing the tutorial of quarkus: https://quarkus.io/guides/getting-started我目前正在做quarkus的教程: https://quarkus.io/guides/getting-started

I changed the localRepository setting in the settings.xml to <localRepository>D:\Zubehoer\Maven\repository</localRepository> and also copied that settings.xml to the.m2 folder in my user home.我将 settings.xml 中的 localRepository 设置更改为<localRepository>D:\Zubehoer\Maven\repository</localRepository>并将该 settings.xml 复制到我的用户主页中的 .m2 文件夹中。 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.当我按照链接教程中所示执行mvn compile quarkus:dev时,依赖项会下载到默认存储库,而不是我将本地存储库更改为的位置。

Lastly the pom of the project:最后是项目的pom:

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.acme</groupId>
  <artifactId>getting-started</artifactId>
  <version>1.0-SNAPSHOT</version>
  <properties>
    <compiler-plugin.version>3.8.1</compiler-plugin.version>
    <maven.compiler.parameters>true</maven.compiler.parameters>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <quarkus-plugin.version>1.5.2.Final</quarkus-plugin.version>
    <quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
    <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
    <quarkus.platform.version>1.5.2.Final</quarkus.platform.version>
    <surefire-plugin.version>2.22.1</surefire-plugin.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>${quarkus.platform.group-id}</groupId>
        <artifactId>${quarkus.platform.artifact-id}</artifactId>
        <version>${quarkus.platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <version>${quarkus-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${compiler-plugin.version}</version>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
        <configuration>
          <systemPropertyVariables>
            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
          </systemPropertyVariables>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>native</id>
      <activation>
        <property>
          <name>native</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>${surefire-plugin.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemPropertyVariables>
                    <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                  </systemPropertyVariables>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <properties>
        <quarkus.package.type>native</quarkus.package.type>
      </properties>
    </profile>
  </profiles>
</project>

Edit: Relevenat image of maven debug output编辑:maven 调试 output 的相关图像maven 调试输出

So by default the <localRepository></localRepository> 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>/path/to/local/repo</localRepository> -->所以默认情况下,mavens settings.xml 的<localRepository></localRepository>属性在评论中: <.-- localRepository** | The path to the local repository maven will use to store artifacts: | | Default. ${user.home}/.m2/repository <localRepository>/path/to/local/repo</localRepository> --> <.-- localRepository** | The path to the local repository maven will use to store artifacts: | | Default. ${user.home}/.m2/repository <localRepository>/path/to/local/repo</localRepository> -->

As I only changed the value of the localRepository property, but did not move the property outside of the comment it didnt work.因为我只更改了 localRepository 属性的值,但没有将属性移到它不起作用的评论之外。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM