wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes Why does manual download with maven fix problems? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Why does manual download with maven fix problems?" Watch "Why does manual download with maven fix problems?" New topic
Author

Why does manual download with maven fix problems?

Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 381
I had a simple spring/JPA console app that used Hibernate JPA provider to update a MSSQL database that was working.

I used the logic in the console program to update my Spring/JPA/Hibernate/MVC servlet and it would not work.

I was getting these errors from Eclipse/Juno:


Finally, after a great deal of cursing and gnashing of teeth, I executed these commands to fix all the problems:


OK, it works now. That took me a long time to figure out. Was it necessary that I go thru all that pain? Why is not maven doing its job? Who is deleting my jar files? I don't know about slf4j and commons-collections, but I'm certain that my groovy console spring/JPA program uses the hibernate-entitymanager version 4.2.0.CR2. So who deleted the jar file and why did not maven download it for my springJPA servlet if it needed it (like it did for my groovy grape)?
Thanks
Siegfried
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Siegfried ,
It might be the possibility that these jars had failed to download in the first place due to some connectivity issue ( although maven does attempt re-download automatically , I dont understand why it didnt do that ). Can you post your pom.xml here ? Meanwhile I want you to do one thing , remove the C:\Users\siegfried\.m2\repository\commons-collections folder so that maven will re-attempt to download the jar again. Do this for all the 3 jars that are causing the issue and see if maven downloads them again or not. Dont forget to run a "mvn clean package" command. Once downloaded , issue the mvn package command again and see if maven is able to locate the jars in the local repo or they have yet again disappeared .

Also do you have some other proxy repositories configured for your maven ? Maybe some configuration issue in the settings.xml might be the problem.


Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Are you running he latest version of Eclipse and the m2e plugin? If so, is it a clean install or did you let Eclipse do an update? (I have found the Eclipse update is sketchy at best and never do it; I always do a clean install of the new components.) If you are on the latest version, have you tried right-clicking a project, selecting Maven | Update Project, and then selecting all of the projects? That usually works for me to get Maven and Eclipse reconciled. Any yes I have to do this pretty much daily - its the first thing I do in the morning after which Eclipse behaves fairly well.


JBoss In Action
Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 381
OK, I'm having a very similar problem -- maybe the same problem. This time I'm using the spring tool suite version 3.2.0.RELEASE.
So turned on Windows Media Player to play the local radio station just to prove that I am connected continuously.

So I have a spring tool suite (STS -- some fancy enhancements to eclipse) project called PropertyGoalSetter. I have a version of the project that implements a minimal CRUD (create-read-update-delete) GUI for many-to-many relationship between class Usr and Project that resides on MSSQLServer. This project is in a directory called PropertyGoalSetterWorks because it seems to work. I just checked it and yes it still works.

Then I copy the contents of this directory to PropertyGoalSetter and use roo to execute the "security setup" command and then (following the examples in Configuring Security right out of the book "Spring Roo in Action") I add a principle class, authority class and a junction class for principle and authority. Then I use the "web mvc scaffold" to create the CRUD GUI for these new classes and the junction table.

Now I compile this I'm seeing a lot of errors from spring tool suite from the markers tab. It seems it cannot find any of my dependencies... So I tried my old trick again and it did not seem to help:
mvn -DgroupId=org.springframework.security -DartifactId=spring-security-core -Dversion=3.1.0.RELEASE dependency:get -DrepoUrl=http://repo1.maven.org/maven2/
mvn -DgroupId=org.springframework.security -DartifactId=spring-security-web -Dversion=3.1.0.RELEASE dependency:get -DrepoUrl=http://repo1.maven.org/maven2/
mvn -DgroupId=org.springframework.security -DartifactId=spring-security-taglibs -Dversion=3.1.0.RELEASE dependency:get -DrepoUrl=http://repo1.maven.org/maven2/
mvn -DgroupId=org.springframework.security -DartifactId=spring-security-config -Dversion=3.1.0.RELEASE dependency:get -DrepoUrl=http://repo1.maven.org/maven2/

Hmmm....
So I try the suggestion and click "maven|update project.. " and update the project. This does not help. I try "clean" and see sts rebuild....

So now I get out the command prompt and switch to my new "PropertyGoalSetter" directory and type

mvn jetty:run

and now (after waiting for a long time while maven downloads the missing jars) it works when I point my google chome browser at http://localhost:8080/PropertyGoalSetter! What is going on? First I had this problem with plain eclipse Juno Service Release 1 (as I described in the original posting) with a plain old spring mvc servlet (and fixed it with the manual mvn commands) and now suddenly I'm having the problem with the STS version of eclipse in the PropertyGoalSetter directory (but not in the PropertyGoalSetterWorks directory).


Ah! Now I just tried the "maven | update project" I see a little check box "force Update of Snapshots/Releases". I did I check that before? I don't remember! Well I check it now and this fixes it and seems to be working from STS (eclipse) again...

I know I had internet connectivity the entire time because I've been listening to NPR on kuow. I wonder if the repositories could be going up and down?

It is hard enough trying to learn Spring and ROO with out having to deal with this nonsense! Thanks for the suggestions!

Siegfried

I'm going nuts!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why does manual download with maven fix problems?
 
Similar Threads
Transitive Dependency Problem
Error Compiling Maven Project
new to maven, error in mvn war:war
Maven newbie - installing jars
Maven Dependency issue