When maven says “resolution will not be reattempted until the update interval of MyRepo has elapsed”, where is that interval specified?

前端 未结 19 1112
迷失自我
迷失自我 2020-11-22 16:49

With maven, I occasionally hit an artifact that comes from some 3rd-party repo that I haven\'t built or included in my repository yet.

I\'ll get an error message fr

相关标签:
19条回答
  • 2020-11-22 17:21

    If you are using Eclipse then go to Windows -> Preferences -> Maven and uncheck the "Do not automatically update dependencies from remote repositories" checkbox.

    This works with Maven 3 as well.

    0 讨论(0)
  • 2020-11-22 17:23

    Maven has updatePolicy settings for specifying the frequency to check the updates in the repository or to keep the repository in sync with remote.

    • The default value for updatePolicy is daily.
    • Other values can be always / never/ XX (specifying interval in minutes).

    Below code sample can be added to maven user settings file to configure updatePolicy.

    <pluginRepositories>
        <pluginRepository>
            <id>Releases</id>
            <url>http://<host>:<port>/nexus/content/repositories/releases/</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>             
    </pluginRepositories>
    
    0 讨论(0)
  • 2020-11-22 17:25

    This works after you delete the related dependency from your local maven repository

    /user/.m2/repository/path
    
    0 讨论(0)
  • 2020-11-22 17:28

    What basically happens is,According to default updatePolicy of maven.Maven will fetch the jars from repo on daily basis.So if during 1st attempt your internet was not working then it would not try to fetch this jar again untill 24hours spent.

    Resolution :

    Either use

    mvn -U clean install
    

    where -U will force update the repo

    or use

    <profiles>
        <profile>
          ...
          <repositories>
            <repository>
              <id>myRepo</id>
              <name>My Repository</name>
              <releases>
                <enabled>false</enabled>
                <updatePolicy>always</updatePolicy>
                <checksumPolicy>warn</checksumPolicy>
              </releases>
             </repository>
          </repositories>
          ...
        </profile>
      </profiles>
    

    in your settings.xml

    0 讨论(0)
  • 2020-11-22 17:28

    How I got this problem,

    When I changed from Eclipse Juno to Luna, and checkout my maven projects from SVN repo, I got the same issues while building the applications.

    What I tried? I tried clean Local repository and then updating all the versions again using -U option. But my problem continued.

    Then I went to Window --> Preferences -> Maven --> User Settings --> and clicked on Reindex button under Local Repository and wait for the reindex to happen.

    That's all, the issue is resolved.

    0 讨论(0)
  • 2020-11-22 17:29

    This error can sometimes be misleading. 2 things you might want to check:

    1. Is there an actual JAR for the dependency in the repo? Your error message contains a URL of where it is searching, so go there, and then browse to the folder that matches your dependency. Is there a jar? If not, you need to change your dependency. (for example, you could be pointing at a top level parent dependency, when you should be pointing at a sub project)

    2. If the jar exists on the remote repo, then just delete your local copy. It will be in your home directory (unless you configured differently) under .m2/repository (ls -a to show hidden if on Linux).

    0 讨论(0)
提交回复
热议问题