Window 更新后 Maven 更改本地存储库

Maven change local respository after Window update

我的项目使用 Java 和 Maven。我的 .m2 在目录 C:\Users\my_user_name 中。我使用这个 .m2 目录作为我项目的唯一存储库。之前一切正常。我也在昨天建立了我的项目成功。今天,我的 window 7 更新,当我构建我的项目时,出现错误

Failed to collect dependencies for [org.jboss.solder:solder-impl:jar:3.1.0.Final (compile), or g.jboss.solder:solder-api:jar:3.1.0.Final (compile), org.jboss.solder:solder-logging:jar:3.1.0.Final (compile), log4j:lo g4j:jar:1.2.6 (provided), javax.enterprise:cdi-api:jar:1.0-SP4 (provided)]: Failed to read artifact descriptor for org.jboss.solder:solder-impl:jar:3.1.0.Final: Failure to find org.jboss.seam:seam-bom:pom:3.1.0.Final in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

我用命令 mvn -X 调试了问题,我得到了结果

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 20:51:28+0700) Maven home: D:\soft\maven\apache-maven-3.0.5 Java version: 1.7.0_45, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.7.0_45\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows" [INFO] Error stacktraces are turned on. [DEBUG] Reading global settings from D:\soft\maven\apache-maven-3.0.5\conf\settings.xml [DEBUG] Reading user settings from C:\Windows\system32\config\systemprofile\.m2\settings.xml [DEBUG] Using local repository at C:\Windows\system32\config\systemprofile\.m2\repository [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for C:\Windows\system32\config\systemprofile\.m2\r epository

如您所见,maven 使用存储库 C:\Windows\system32\config\systemprofile。我已经检查并看到那里有另一个 .m2 目录,而这个 .m2 目录没有足够的 .jar 文件。

我还把 <repositories> 配置标签和内容

<repositories>
        <repository>
          <id>repo.maven.apache.org</id>          
          <url>http://repo.maven.apache.org/maven2</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>repository.jboss.org</id>          
          <url>https://repository.jboss.org/nexus/content/groups/public</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>maven.nuxeo.org</id>          
          <url>https://maven.nuxeo.org/nexus/content/repositories/public</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>   
      </repositories>

在文件settings.xml中 C:\Users\my_user_name\.m2\repository。所以我的问题是:如何在 C:\Users\my_user_name 中将本地存储库更改为 .m2? (因为这个 .m2 是正确的存储库,我已经将我所有的 .jar 放到这个存储库中)。

请密切注意您收到的错误消息:

Failure to find org.jboss.seam:seam-bom:pom:3.1.0.Final in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

所以 Maven 是在告诉您,除非您告诉它强制更新,否则它不会尝试修复依赖性问题。以下是您的操作方法:

mvn clean install -U

mvn clean install --update-snapshots

-U 标志执行以下操作(来自键入 mvn -help):

Forces a check for missing releases and updated snapshots on remote repositories