0

I have a local jar in my project and I can't do

mvn compile war:war

because I get this error:

Failure to find myLib in https://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]

What do I need to add to the pom to fix this?

  • Possible duplicate of [When maven says "resolution will not be reattempted until the update interval of MyRepo has elapsed", where is that interval specified?](https://stackoverflow.com/questions/4856307/when-maven-says-resolution-will-not-be-reattempted-until-the-update-interval-of) – Federico klez Culloca Mar 01 '18 at 09:26
  • @FedericoklezCulloca not at all, it seems like there is a local jar that is a non-maven dependency but is defined as such. – kutschkem Mar 01 '18 at 09:29
  • check this out: https://stackoverflow.com/questions/41471392/failure-to-find-project-in-maven-repository – 张宇鹏 Mar 01 '18 at 09:33

1 Answers1

0

You can not access the maven central repository on the internet. The information is a bit vague so I would try all of these steps as a check, you may well have already done some.

Start by downloading maven from http://mirror.vorboss.net/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip

Unzip it somewhere, then assuming your're on windows

1) set an environment variable M2_HOME to point at the unziped folder.

2) add %M2_HOME%/bin to your PATH environment variable

3) go to your home directory (probably C:/Users/????? and create a .m2 folder

4) move the settings.xml file from the maven unzippped/conf directory to the directory created in step 3.

5) you may have to set the proxy element correctly in your settings.xml file (see here for details)

Check all is working by doing:

greg@greg-XPS-13-9360:~/work/local-repo$ mvn -version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-112-generic", arch: "amd64", family: "unix"
Essex Boy
  • 7,565
  • 2
  • 21
  • 24
  • that error is from a local library. it's not on the internet. it's in my project –  Mar 01 '18 at 09:35
  • if you're sure you can connect to the internet and maven central then blow away your ~/.m2/repo folder/myLib – Essex Boy Mar 01 '18 at 09:37
  • dude that lib is not on the maven repo –  Mar 01 '18 at 09:40
  • The error says that you are trying to load a dependency called myLib from maven central, so of course it's not there, so your local repo adds some place holder files to stop it keep asking maven, I think you need to check your whole set up. – Essex Boy Mar 01 '18 at 09:57