Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven and Eclipse - updating jar to newer version

 
A F Jones
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I hope it's OK to ask a newbie question about how to update a Maven built Eclipse project as I'm finding it very hard to get to grips with Maven and how it works.

I followed instructions in a book as to how to download and install a Maven project for Eclipse - mvn clean package and mvn eclipse:clean eclipse:eclipse and then create a new Eclipse project from the existing source.

However I now have to update one of the jar files to a newer version for a bug fix, and I don't know how. The updated jar is at http://repository.codehaus.org/org/mvel/mvel2/2.0.13/

I tried copying the new jar into the library folder where the other jars for the Eclipse plugin are stored and adding it to the build path of the project as an external jar (couldn't figure out how to get it in as part of the existing library) but it didn't work. Should I copy it to the Maven repository folder? Or do something with the short pom file that goes with the updated jar, like edit the original pom file on my system (which obviously covers a whole bunch of other jars) to add stuff from the short pom file, and if so which bits of the file? And how do I get Eclipse to recognise the new jar instead of the older version, will deleting the old jar from the filesystem be enough?

Any help would be very much appreciated. Thanks in advance.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should upgrade version dependencies in the POM.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably the Number 1 selling point of Maven is that it fetches and caches dependencies for you. You don't have to download the updated JAR, just update the version number of the JAR in your Maven POM file and do a clean and rebuild. When you do that, Maven will check your local repository (cache) and, if the jar hasn't already been downloaded, it will go to the maven repositories, find a copy, and download it (this is assuming you didn't do an offline build!). Then it will use that copy to do your new build with.
 
A F Jones
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your replies. I've found the POM file and will edit it.

I'm new to this so I'll just have to go figure out how to do a clean and rebuild - if you'll forgive that it's so basic, am I right in thinking that you go to the directory where the edited POM file is and do mvn clean then mvn install, please?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That usually works. You can abbreviate it to "mvn clean install", however.
 
A F Jones
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Tim I shall try that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic