3

我的项目的 pom 文件具有以下分发管理标签

<distributionManagement>
    <repository>
        <id>confiz-repo</id>
        <url>http://10.10.10.230:8081/nexus/content/repositories/snapshots/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
</distributionManagement>

我使用 mvn deploy 这给了我成功。所以我知道我的工件已成功部署。现在我的 settings.xml 文件如下

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <pluginGroups>
  </pluginGroups>

  <proxies>
  </proxies>

  <servers>
    <server>
      <id>confiz-repo</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
  </servers>

  <mirrors>
    <mirror>
      <!-- The id of this mirror and the server instance above needs to be the same!-->
      <id>confiz-repo</id>
      <mirrorOf>*</mirrorOf>
      <url> http://10.10.10.230:8081/nexus/content/groups/public/</url>
    </mirror>
    <mirror>
      <!-- The id of this mirror and the server instance above needs to be the same!-->
      <id>confiz-repo</id>
      <mirrorOf>*</mirrorOf>
      <url> http://10.10.10.230:8081/nexus/content/repositories/snapshots/</url>
    </mirror>
  </mirrors>

  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>confiz-repo</id>
          <url>http://central</url>
          <releases>
        <enabled>true</enabled>
      </releases>
          <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
      </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>confiz-repo</id>
          <url>http://central</url>
          <releases>
        <enabled>true</enabled>
      </releases>
          <snapshots>
        <enabled>true</enabled>
      </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>


  <activeProfiles>
    <activeProfile>nexus</activeProfile>
  </activeProfiles>

</settings>

现在,当我将第一个项目的依赖项包含到我的第二个项目中并运行 mvn clean install maven 时会抱怨

[ERROR] Failed to execute goal on project merchant: Could not resolve dependencies for project com.onestopspot:merchant:apk:1.0.1-SNAPSHOT: Could not find artifact com.confiz.abc:my-artifact:jar:1.0-SNAPSHOT in confiz-repo (http://10.10.10.230:8081/nexus/content/groups/public/) -> [Help 1]

我究竟做错了什么 ?

编辑- 我可以看到我的工件部署在 nexus 中。所以我说 mvn deploy 可以正常工作是对的。但是 nexus 试图读取的路径http://10.10.10.230:8081/nexus/content/groups/public/不包含我的工件。

4

1 回答 1

0

您的第二个项目正在尝试从不存在的 nexus 中获取第一个项目的工件

  1. 您可能希望在 nexus 上部署快照
  2. 如果您不想这样做 1.mvn clean install -o在离线模式下运行第二个项目
于 2013-03-29T18:42:49.143 回答