论坛首页 Java企业应用论坛

IDEA Maven无法从本机nexus下载jar包的问题

浏览 9052 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2015-10-25  
说明:nexus安装在本机。
本机maven配置文件如下:
<server>
      <id>user-releases</id>
      <username>admin</username>
      <password>admin123</password>
    </server>

    <server>
      <id>user-snaphots</id>
      <username>admin</username>
      <password>admin123</password>
    </server>

    <mirror>
      <id>MyNexus</id>
      <mirrorOf>*</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://localhost:8081/nexus/content/groups/public/</url>
    </mirror>

    <profile>
      <id>MyProfile</id>

      <activation>
        <jdk>1.8</jdk>
      </activation>

      <repositories>
        <repository>
          <id>central</id>
          <name>Repository for central builds</name>
          <url>http://localhost:8081/nexus/content/groups/public/</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>

  <activeProfiles>
    <activeProfile>MyProfile</activeProfile>
    <!--<activeProfile>anotherAlwaysActiveProfile</activeProfile>这里可以配置多项的-->
  </activeProfiles>
然后我在IDEA中配置了maven,然后在Project1中建了一个类,发布到nexus成功,在nexus中可以查到,然后在IDEA中新建一个maven项目Project2,在pom文件中添加上面这个依赖jar包,下载不下来。

project1和project2的pom文件一样:

<distributionManagement>
        <repository>
            <id>user-releases</id>
            <url>http://localhost:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>user-snaphots</id>
            <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
其中project2中添加依赖:
    ​    <dependency>
            <groupId>com.msp.test</groupId>
            <artifactId>TestModuleOne</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

报错:Could not resolve dependencies for project com.msp.test:MavenTest3:jar:1.0-SNAPSHOT:
Failed to collect dependencies at com.msp.test:TestModuleOne:jar:1.0-SNAPSHOT:
Failed to read artifact descriptor for com.msp.test:TestModuleOne:jar:1.0-SNAPSHOT:
Failure to find com.msp.test:MavenTest1:pom:1.0-SNAPSHOT in http://localhost:8081/nexus/content/groups/public/ was cached in the local repository,
resolution will not be reattempted until the update interval of MyNexus has elapsed or updates are forced
   发表时间:2015-11-01  
使用IDEA 左下角的Terminal下,mvn clean install 尝试下
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics