1

I have a maven project from Github, I fork it, and then I imported it to eclipse. It contains three maven modules. I added a fifth one.

Now I want to add this fifth (new) as a dependency to one of the previous modules.

I did the install in maven, and I got the jar located in my local repository. now when I added a dependency to a one of the previous modules, i got error that my new models doesn't exist in the public dependency. I mean:

Failed to execute goal on project moquette-broker: Could not resolve dependencies for project org.eclipse.moquette:moquette-broker:jar:0.7: Failure to find org.eclipse.moquette:moquette-configurationmanager:jar:0.7 in https://repo.eclipse.org/content/repositories/paho-releases/ was cached in the local repository, resolution will not be reattempted until the update interval of Paho Releases has elapsed or updates are forced -> [Help 1]

my question is how can I tell eclipse to search in my local repository as well?

I tried to upload my dependency to a public repository but it doesn't make any sence now because i am still developing

could you help please

the jar in my local repository

enter image description here

this is what i put in the pom in order to call my new module

<dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>moquette-configurationmanager</artifactId>
            <version>${project.version}</version>
            <scope>Test</scope>
        </dependency>

and the image that i published is my local repository, because i can see that from my eclipse, like this: enter image description here

Marco Dinatsoli
  • 10,322
  • 37
  • 139
  • 253
  • Have you tried mvn clean install -U ? – JFPicard Aug 03 '15 at 14:11
  • Have you checked that the install was done OK, and that it created the file `$userprofile/.m2/repository/org/eclipse/moquette/moquette-broker/0.7/moquette-broker-0.7.jar` ? – Little Santi Aug 03 '15 at 14:19
  • @JFPicard yes I did and I got the same error, which is `Failed to execute goal on project moquette-broker: Could not resolve dependencies for project org.eclipse.moquette:moquette-broker:jar:0.7: Could not find artifact org.eclipse.moquette:moquette-configurationmanager:jar:0.7 in Paho Releases (https://repo.eclipse.org/content/repositories/paho-releases/) -> [Help 1]` – Marco Dinatsoli Aug 03 '15 at 14:25
  • @LittleSanti yes I checked and It is in the same location. I can see it by naked eye – Marco Dinatsoli Aug 03 '15 at 14:25
  • Can you please post your pom.xml ? – JFPicard Aug 03 '15 at 14:26
  • @JFPicard do you mean the pom.xml for the module that is using my new module ? – Marco Dinatsoli Aug 03 '15 at 14:27
  • Can you share your pom.xml file(s)? – Matthias J. Sax Aug 03 '15 at 14:29
  • @MatthiasJ.Sax for which pom.xml are you talk about? i have one for the parent project, and 5 modules. I guess you wants the one for the module that is using my new module. aren't you? – Marco Dinatsoli Aug 03 '15 at 14:31
  • Yes. Why do you include it as `Test`? Looks wrong to me. And your screenshot does not show your local maven repo. This should be `$HOME/.m2/repository/...` – Matthias J. Sax Aug 03 '15 at 14:38
  • @MatthiasJ.Sax i added `scrop` as a desperate attempt. i will remove it and then apply `mvn clean install -U` plus, i though that my home/.m2/reporitory is my local repository. anyway how can i add to the local repository? because i might have alradyed added it since i tried so so so many time – Marco Dinatsoli Aug 03 '15 at 14:40
  • @MatthiasJ.Sax now i removed the scope and applied `mvn clean install -U ` again and still getting the same exact error message – Marco Dinatsoli Aug 03 '15 at 14:40
  • @MatthiasJ.Sax i guess that is my local repository, i will tell you why in an updated question – Marco Dinatsoli Aug 03 '15 at 14:41
  • If you run `maven install` in the new module (not parent module) and the build is successful, maven copies the result jar file into your local repo automatically. – Matthias J. Sax Aug 03 '15 at 14:42
  • @MatthiasJ.Sax i already did that, and i will do that again now and update u – Marco Dinatsoli Aug 03 '15 at 14:44
  • @MatthiasJ.Sax i guess you mean mvn install not maven install – Marco Dinatsoli Aug 03 '15 at 14:44
  • @I did mvn install in my new modules and i got build successful, all is good. then i went to the old modules and did again mvn clean install -U ,but i got the same error message – Marco Dinatsoli Aug 03 '15 at 14:45
  • Do only a `mvn clean install` (without `-U`). Flag `-U` forces maven to lookup in remote repository -- and that is exactly what you don't want it to do... – Matthias J. Sax Aug 03 '15 at 14:51
  • @MatthiasJ.Sax i just tried without -U and I got the exact same error. the only difference is that mvn didn't install my old dependencies again, it directly told me that there is error (which is told u that error before) – Marco Dinatsoli Aug 03 '15 at 14:54
  • Did you run without -U in new module or parent module? (parent module would be correct -- for your new module it should not make a difference) – Matthias J. Sax Aug 03 '15 at 14:56
  • @MatthiasJ.Sax i did that in the new module **not** the parent, do you want to do that in the parent as well? – Marco Dinatsoli Aug 03 '15 at 14:59
  • @MatthiasJ.Sax i notice that i don't have settings.xml in `~/.m2/settings.xml` is that normal? – Marco Dinatsoli Aug 03 '15 at 14:59
  • `settings.xml` is optional. – Matthias J. Sax Aug 03 '15 at 15:01
  • @MatthiasJ.Sax i am using mac os, check this answer please http://stackoverflow.com/questions/11031171/mvn-package-fails-with-required-artifact-missing-even-though-it-exists-in-my-rem they guys is saying that i should change something in the setting.xml do you think i should create that file and add this line?`${env.HOME}/.m2/repository` ? – Marco Dinatsoli Aug 03 '15 at 15:01
  • Try to run `mvn clean install` (without `-U`) in parent module. – Matthias J. Sax Aug 03 '15 at 15:02
  • @MatthiasJ.Sax i did what you said, and i got the same error. i mean i run mvn clean install in the parent project (not parent module) and i got the same error – Marco Dinatsoli Aug 03 '15 at 15:04
  • @MatthiasJ.Sax please do you think i have to add settings.xml file and add this line ${env.HOME}/.m2/repository ? – Marco Dinatsoli Aug 03 '15 at 15:06
  • but i highly double that the problem is from the local repository because i have hundereds of dependencies in my local repository and all work good – Marco Dinatsoli Aug 03 '15 at 15:07
  • You don't need to add this to setting.xml -> `mvn install` worked in new module and the jar was copied into .m2/repositiory -- thus, the repo is set up correctly. – Matthias J. Sax Aug 03 '15 at 15:08
  • I don't have any more ideas... maybe you want to try disabling remote repository... https://stackoverflow.com/questions/4997219/disable-maven-central-repository – Matthias J. Sax Aug 03 '15 at 15:11
  • @MatthiasJ.Sax you tried your best man, let's wait maybe someone else will help. i can't disable the remove repository. now i will add the jar manually by hand, then wait for some other user maybe they have the luck to discover the mesury of maven, maven bad so bad so so so bad – Marco Dinatsoli Aug 03 '15 at 15:13
  • Can you provide repo that actualy has `org.eclipse.moquette:moquette-configurationmanager:jar:0.7` global one ? Because in `https://repo.eclipse.org/content/repositories/paho-releases/` i dont see there – Paweł Głowacz Aug 03 '15 at 19:14

1 Answers1

1

After reading the first 28 comments and responses to your question, I still cannot imagine the cause of this strange error, so you'll have to debug it a bit more:

Two recommendations to debug the Maven build:

  • Whatever test you run, execute mvn --debug <phase> and analyze carefully the produced log.
  • Run mvn dependency:build-classpath to ask Maven where are the downloaded libraries referenced in the classpath.
Little Santi
  • 8,563
  • 2
  • 18
  • 46