How to download Spring Framework JAR files with and without Maven or Gradle
In java If we need to use some functionality to developed by someone else. we need to include that functionality as a class file in our jar or war file.
We need a jar file of that compiled classes. Before the invention of the maven, the developer used to include that jar files to their classpath. and that's it. They can use the third party jar in their project.
But the invention of Maven and after Gradle makes developers' life much easier.
The developers need to include jar dependency with versions in the pom.xml file. and that's it. no classpath setup is needed.
Maven automatically downloads all jar files of the specified version along with their dependencies. for you.
- If jars are already present in local system i.e .m2 directory it takes it
- If not they search jar files in maven central repository with given version where other developers put all compiled jar files.
- Download all dependencies in the local .m2 directory.
- Make references to that jar file.
- Run the application project or build the.
- If fat jar included all required jar libraries from the .m2 directory into classpath and build an independent fat jar.
In this article, I will explain how to download any open source library JAR like spring hibernates,spring boot, etc with and without using Maven or Gradle or any other dependency management tool.
1). Download Spring framework JAR from Maven Central Repository
If you are using Maven, we know that Maven downloads all the JAR files from the repository in the cloud, it could be the local or , Maven central, or nexus repository.
The open-source libraries of any version can be downloaded from other repositories. You can see the maven central dependency just by searching like
eg spring-core maven
it will give first like as https://mvnrepository.com/artifact/org.springframework/spring-core You have to select the required version
Here is
5.2.6.RELEASE is the latest
Select it
<dependency>
<groupid>org.springframework</groupid>
<artifactid>spring-core</artifactid>
<version>5.2.6.RELEASE</version>
</dependency>
Put this dependency in your pom.xml
On command line go to your project dir
Use commands
mvn eclipse:clean
maven eclipse:eclipse
mvn clean install
If you are using eclipse use
Goto project right click->maven->update project
all this dependency will be downloaded to localtion
C:\Users\{username}\.m2\repository\ org\springframework\spring-core\5.2.6.RELEASE\
For Windows
/devuser/home/.m2/repository/org/springframework/spring-core/5.2.6.RELEASE/
For Linux
Here is jar file you want to download.
2). You can go to website jar-download.com or java2s.com
On jar-download.com Search the jar file and download it.
or
On java2s.com Search the jar file and download it.
3). Spring frameworks official site
For downloading the spring jars you go to springs open cdn website.
Spring frameworks official site
Select the version of jar you want to download
eg I selcted 5.2.6.RELEASE
Click on spring-5.2.6.RELEASE-dist.zip link,
It automatically downloads all the spring jars in the zip.
If you are using Gradle in your project
Open build.gradle file and put a dependency on it
dependencies {
compile 'org.springframework:spring-core:5.2.6.RELEASE'
}
0 Comments
Post a Comment