簡體   English   中英

未使用 Maven settings.xml

[英]Maven settings.xml not used

我正在創建一個包含父 pom 的 Maven 模塊。 此父工件存儲在 nexus maven 存儲庫中。 我將 nexus 存儲庫添加到我的 settings.xml 中。 現在,如果我正在構建我的子模塊,則會出現錯誤: Could not find artifact test:my.parent:pom:1.0

似乎默認情況下不使用settings.xml 如果我將<repositories><repository><id>random</id><url>http://test/repository/maven-releases/</url></repository></repositories>到我的孩子的 pom 中,一切正常很好,使用 settings.xml 並找到父工件。

我是否錯過了默認情況下將使用 settings.xml 的任何內容,或者這是預期的行為? 我不想將這個隨機 repo 標簽添加到我的每個子 poms 中。

父 Pom:

  <groupId>test</groupId>
  <artifactId>my.parent</artifactId>
  <version>1.0</version>
  <packaging>pom</packaging>

模塊化 Pom:

  <parent>
    <groupId>test</groupId>
    <artifactId>my.parent</artifactId>
    <version>1.0</version>
  </parent>

  <artifactId>my.module</artifactId>
  <version>1.0</version>
  <packaging>pom</packaging>

設置.xml

<settings>
  <mirrors>
    <mirror>
      <id>Nexus</id>
      <url>http://mynexus:8081/repository/maven-group/</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
<settings

據我所知,您可以使用 IDE 或命令行調用 maven。

如果您從 IDE 調用,請檢查設置是否映射到您的 settings.xml 文件

如果您使用命令行,則可以使用mvn --v進行檢查,它會顯示您的 Maven 家在哪里。 然后你可以在conf/settings.xml下檢查你的設置文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM