aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven and Eclipse - updating jar to newer version Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven and Eclipse - updating jar to newer version" Watch "Maven and Eclipse - updating jar to newer version" New topic
Author

Maven and Eclipse - updating jar to newer version

A F Jones
Greenhorn

Joined: Aug 19, 2009
Posts: 5
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

Joined: Sep 29, 2008
Posts: 12617

You should upgrade version dependencies in the POM.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15661
    
  15

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
A F Jones
Greenhorn

Joined: Aug 19, 2009
Posts: 5
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

Joined: Jun 25, 2001
Posts: 15661
    
  15

That usually works. You can abbreviate it to "mvn clean install", however.
A F Jones
Greenhorn

Joined: Aug 19, 2009
Posts: 5
Thank you Tim I shall try that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven and Eclipse - updating jar to newer version
 
Similar Threads
Is there a way to create application (ear) project from maven to eclipse?
Maven installation and using in project without Internet conncetion
maven java:compile
Maven: What's the big deal?
Publish to maven repository as "latest"