2

I did mvn install and get this error message Failed to execute goal on project core: Could not resolve dependencies for project test:core:jar:2.0.1-SNAPSHOT: Could not find artifact lib-net:lib-net:jar:1.0.8 in central (http://repo.maven.apache.org/maven2)

this dependency is a Project of mine, which is available in the local repository ~/.m2

so I tried mvn install -o to force maven to use my local repository, and I get this

Failed to execute goal on project core: Could not resolve dependencies for project test:core:jar:2.0.1-SNAPSHOT: The repository system is offline but the artifact lib-net:lib-net:jar:1.0.8 is not available in the local repository.

I tried to delete my local repository and install everything again, but it doesn't solve my problem!

Any sugestions?

user2071938
  • 2,055
  • 6
  • 28
  • 60
  • Did you define your local repository in pom file? – degr Dec 05 '16 at 07:45
  • 1
    like here for an example - https://www.mkyong.com/maven/where-is-maven-local-repository/ – degr Dec 05 '16 at 07:47
  • no, I use the default location ~/.m2/repository – user2071938 Dec 05 '16 at 07:48
  • Sound's like you have problem with file system structure. For an example you should have: com/user2071938/lib-net/1.0.8.BUILD-SNAPSHOT/[something with maven metadata files]. I had same problem in the past, and It was possible to resolve it only after I do "clean install" on maven project with type "jar". After it maven pack my project properly and I was able to use it in other projects. – degr Dec 05 '16 at 07:53

2 Answers2

1

The problem is with maven version. I had the same issue on my Jenkins machine. I followed these steps and it resolved my issue:

  1. Delete the specific older libraries in ~/.m2/
  2. Change the version of maven to apache-maven-3.5.0
  3. Re-run the maven goals
Shashi Ranjan
  • 1,491
  • 6
  • 27
  • 52
0

Think I know way how to do it properly

  1. Download sources of your library locally
  2. Go to ~/.m2/ and search for your lib
  3. Delete it from here
  4. perform "mvn clean install" for your library
  5. search for your lib in ~/.m2/
  6. try to "mvn clean install" on your main project
  7. ... ?
  8. Profit

If it will no work, check that you use correct artifact id and group id.

degr
  • 1,559
  • 1
  • 19
  • 37