Gary Kephart
Gary Kephart

Reputation: 4994

Need Spring version# - only have spring.jar file

I've inherited an app that uses Spring. The original developers are not available. The Spring jar file is just "spring.jar", so there's no version# in the filename to help me. I'd like to download the Spring source corresponding to the jar file. The MANIFEST.MF file has "Spring-Version: 1.2" however that's not precise enough. I've looked at version 1.2.1 and 1.2.9 and it doesn't match up quite right. The key thing is that org.springframework.web.servlet.view.AbstractCachingViewResolver has a prepareView method which is called from resolveViewName and it does not seem to be in 1.2.1 or 1.2.9.

Is there any easy way to track down the right version?

Upvotes: 40

Views: 83910

Answers (10)

Jekz Leonidas
Jekz Leonidas

Reputation: 11

 mvn dependency:tree | findstr  org.springframework | findstr 'spring-core:jar'

i used this command in VSCode (Windows PC) and it shows the current version.

Upvotes: 1

JR Sahoo.'JS'
JR Sahoo.'JS'

Reputation: 1698

open the jar & check in spring.jar > META-INF > MANIFEST.MF

enter image description here

Upvotes: 0

Brad Parks
Brad Parks

Reputation: 72293

If your project uses Maven, you can run the following at the command line to see it:

$ mvn dependency:tree | grep org.springframework | grep 'spring-core:jar'

Upvotes: 18

shaik rizwan
shaik rizwan

Reputation: 7

go to MATA-INF directory and open manifest file.It will be there what version you are using.

Upvotes: -2

misterGrosar
misterGrosar

Reputation: 304

You cann check it in pom.xml file in <org.springframework-version> tag.

Upvotes: 9

duffymo
duffymo

Reputation: 309008

This will do it:

import org.springframework.core.SpringVersion;

public class VersionChecker
{
    public static void main(String [] args)
    {
        System.out.println("version: " + SpringVersion.getVersion());
    }
}

Compile and run this with spring.jar in your CLASSPATH and it'll display the version for you. See the javadocs as well.

Upvotes: 80

vehnae
vehnae

Reputation: 666

The really easy way is to get the MD5 sum of the archive and google it. Many sites that store .jar archives also index the MD5 sums which Google then finds easily. This works really well for pretty much any Java components.

$ md5sum spring-2.5.5.jar
82a2134b227f717066da4f4b059925d3

http://www.google.com/search?q=82a2134b227f717066da4f4b059925d3

Upvotes: 8

Michael Wiles
Michael Wiles

Reputation: 21194

You can try looking inside the jar's MANIFEST.MF in the META-INF directory - it should indicate what version yo're working with.

Upvotes: 2

victor hugo
victor hugo

Reputation: 35858

According to mvnrepository.com 1.2.9 weights 2.2MB and 1.2.1 weights 2.0MB, that page also has a link for downloading both. I think the weight difference is enough for comparing the files. If you can't see the difference just checksum. If you can't see a relation neither with 1.2.1 nor 1.2.9 you can use the page to download any other version quickly (I use it often)

NOTE: If your JAR is below 2.0MB then I'm afraid duffymo has reason and your JAR is 1.2

Upvotes: 2

user73774
user73774

Reputation:

How about checksumming the JAR file and comparing it to the spring.jar files in the distributions from SpringSource? Might take an hour or so to do the downloads, but it should be definitive.

Upvotes: 4

Related Questions