• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how's Maven keep the old version of jar files ?

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good day,

Just started to learn maven and I have a general question.

- if i have following spring-core jar file version in 3.0.5.RELEASE, in future if 3.0.5.RELEASE is too old after sometimes, how could maven still able to reference the old jar file? does it required us to keep updating the version?

 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, if you want to upgrade to new version of spring, you have to change the version number in the Pom.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have a version # hardcoded (like in this example) and don't have any other info in the pom conflicting with it, Maven will use 3.0.5 forever. It is stored in Maven Central and Maven can pull it down years from now. It is also stored in your local .m2 cache so Maven doesn't have to keep downloading it from the internet. You can see the list of Spring core versions Maven has available. If you page through, you can see there are 62 versions going all the way back to 1.0.

If you want Maven to pull a later version, you need to update your file. Or you can specify a more generic version like LATEST and have Maven take care of that automatically.
 
Nakataa Kokuyo
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jeanne for pointing out!

if user put in wrong version, would maven take the closer jar file from m2 cache folder? the existing jar file will be remove from LIB folder if it no longer mentioned in pom.xml ?
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nakataa Kokuyo wrote:if user put in wrong version, would maven take the closer jar file from m2 cache folder?


Not sure what you mean by "closer jar."

Nakataa Kokuyo wrote: the existing jar file will be remove from LIB folder if it no longer mentioned in pom.xml ?


The jar would still be in the .m2 cache, but not in your application when you take it out of the pom.xml.
 
Nakataa Kokuyo
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nakataa Kokuyo wrote:if user put in wrong version, would maven take the closer jar file from m2 cache folder?


Jeanne Boyarsky wrote:Not sure what you mean by "closer jar."



Sorry,might be stupid question

I means if the version suppose 3.0.5.RELEASE and user enter the version wrongly to 3.0.x.RELEASE and assume the version doesn't exist, would it scan and download the closer version or probably get the latest based on <artifactid> ?
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah. If you specify a version that doesn't exist, Maven will complain at build time. It will not infer something else or get the latest.

You can specify a range of version of "LATEST" which behave that way - and do infer the latest. But an actual incorrect version will not build. Which is nice - Maven is notifying you about a typo.
 
reply
    Bookmark Topic Watch Topic
  • New Topic