One of the easiest and oldest ways to run a Java program which depends on an external library or framework is to download dependency JAR files, put them on the classpath and then run the program by creating a Main class with the main() method. This is simple but not as easy as you think, there are many challenges down the road e.g. you need to find the right version of JAR files and their dependencies e.g. Spring might have a dependency on other third-party libraries like Log4j. So, when the build tool like Maven and Gradle comes, everybody stopped downloading the JAR file manually.
All they do is specify the Maven dependency and Maven will download the JAR file of the specified version along with their dependencies. This greatly simplified the development and testing of Java application which uses a framework like Spring and Hibernate.
But if you are not using Maven or Gradle or don't know about them but you want to start with Spring or Hibernate by just downloading their JAR files and putting them into classpath where should you go? Traditionally the framework websites also provide download links but Spring's official site, just list Maven dependencies, it doesn't provide a download link to the latest Spring JAR files.
In this article, I am going to share with you a trick to download not just Spring but any open source library JAR without using Maven or Gradle, or any other dependency management tool.
By the way, if you are new to the Spring framework then I also suggest you join a comprehensive and up-to-date course to learn Spring in depth. If you need recommendations, I highly suggest you take a look at Spring Framework 5: Beginner to Guru, one of the comprehensive and hands-on course to learn modern Spring.
So, in order to download the Spring framework, just go to the maven central website and enter the groupId, artifactId, version, and classifier which you can get from the official Spring website and it will then present the download link.
Alternatively, you can also go to the http://maven.springframework.org/release/org/springframework/spring/ and choose the version of Spring framework you want to download e.g. here are a direct link to download the latest version of Spring, Spring 4.0 and Spring 3.2 and Spring 2.5
Spring 5.0 - https://maven.springframework.org/release/org/springframework/spring/5.0.0.RELEASE/
All they do is specify the Maven dependency and Maven will download the JAR file of the specified version along with their dependencies. This greatly simplified the development and testing of Java application which uses a framework like Spring and Hibernate.
But if you are not using Maven or Gradle or don't know about them but you want to start with Spring or Hibernate by just downloading their JAR files and putting them into classpath where should you go? Traditionally the framework websites also provide download links but Spring's official site, just list Maven dependencies, it doesn't provide a download link to the latest Spring JAR files.
In this article, I am going to share with you a trick to download not just Spring but any open source library JAR without using Maven or Gradle, or any other dependency management tool.
By the way, if you are new to the Spring framework then I also suggest you join a comprehensive and up-to-date course to learn Spring in depth. If you need recommendations, I highly suggest you take a look at Spring Framework 5: Beginner to Guru, one of the comprehensive and hands-on course to learn modern Spring.
Download Spring framework JAR from Maven Central Repository.
If you know Maven, you know that Maven downloads all the JAR files from the specified repository, it could be the local nexus repository or public Maven central repository. Maven central hosts almost all open source libraries and every version of them and the good part are that you can access the maven central library by using your web browser without installing Maven.So, in order to download the Spring framework, just go to the maven central website and enter the groupId, artifactId, version, and classifier which you can get from the official Spring website and it will then present the download link.
Alternatively, you can also go to the http://maven.springframework.org/release/org/springframework/spring/ and choose the version of Spring framework you want to download e.g. here are a direct link to download the latest version of Spring, Spring 4.0 and Spring 3.2 and Spring 2.5
Spring 5.0 - https://maven.springframework.org/release/org/springframework/spring/5.0.0.RELEASE/
Spring 5.2 - https://maven.springframework.org/release/org/springframework/spring/5.2.8.RELEASE/
Spring 4.0 - https://maven.springframework.org/release/org/springframework/spring/4.2.0.RELEASE/
Spring 3.2 - https://maven.springframework.org/release/org/springframework/spring/3.2.0.RELEASE/
Spring 2.5 - https://maven.springframework.org/release/org/springframework/spring/2.5/
Though I strongly advise you to spend some time learning Maven or Gradle to manage dependencies in Java project. It will save you tons of times because downloading Spring framework JARs using Maven is as simple as adding the following XML snippet into the pom.xml file:
Similarly, with Gradle, you can add the following link to download Spring framework JAR files:
That's all about how to download spring JAR files without using Maven or Gradle in the Java project. As I said, you can either download Spring JAR files for any version like Spring 2.5, Spring3.2, and Spring4.2 from Maven Central or http://maven.springframework.org.
Spring 4.0 - https://maven.springframework.org/release/org/springframework/spring/4.2.0.RELEASE/
Spring 3.2 - https://maven.springframework.org/release/org/springframework/spring/3.2.0.RELEASE/
Spring 2.5 - https://maven.springframework.org/release/org/springframework/spring/2.5/
Though I strongly advise you to spend some time learning Maven or Gradle to manage dependencies in Java project. It will save you tons of times because downloading Spring framework JARs using Maven is as simple as adding the following XML snippet into the pom.xml file:
<dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.2.4.RELEASE</version> </dependency> </dependencies>
Similarly, with Gradle, you can add the following link to download Spring framework JAR files:
dependencies {
compile 'org.springframework:spring-context:4.2.4.RELEASE'
}
In order to download the different versions of the Spring JAR file, you just need to change the version number in the Maven pom.xml and Gradle builds a file. For example, if you want to download Spring 5.2.8 version JAR file just change the version to 5.2.8.RELEASE on pom.xml and Gradle file.
That's all about how to download spring JAR files without using Maven or Gradle in the Java project. As I said, you can either download Spring JAR files for any version like Spring 2.5, Spring3.2, and Spring4.2 from Maven Central or http://maven.springframework.org.
The second one much easier than the first one but once you know how to manually search dependency in Maven central repository you can download any JAR file for any open-source framework e.g. Hibernate.
Further Reading
Spring Framework 5: Beginner to Guru
Spring Master Class - Beginner to Expert
Introduction to Spring MVC 4 By Bryan Hansen
Spring and Hibernate for Beginners
Spring in Action 5th edition by Craig Walls
Spring Framework 5: Beginner to Guru
Spring Master Class - Beginner to Expert
Introduction to Spring MVC 4 By Bryan Hansen
Spring and Hibernate for Beginners
Spring in Action 5th edition by Craig Walls
Other Spring Framework tutorials you may like
Thanks for reading this tip, if you like this article then please share it with your friends and colleagues. If you have any suggestions or feedback, feel free to drop a comment.
P. S. - If you want to learn how to develop RESTful Web Service using Spring MVC in-depth, I suggest you join the REST with Spring master class by Eugen Paraschiv. One of the best courses to learn REST with Spring MVC.
- Spring HelloWorld Example using XML Configuration (tutorial)
- Top 5 Spring and Hibernate courses for experienced programmers (list)
- 5 Books to Learn Spring Framework better (list)
- 10 Free Courses to learn Spring Boot for Beginners (Free courses)
- How to implement Role-based Access Control using Spring Security? (tutorial)
- 10 Best Spring Security Courses for Java developers (online courses)
- How to call a stored procedure from Java using Spring JDBC? (tutorial)
- 10 Advanced Spring Boot Courses for experienced developers (courses)
- How to access a DB connection pool using Spring? (tutorial)
- 10 Courses to learn Microservice in Java with Spring Boot (microservices)
- What is the difference between BeanFactory vs ApplicationContext in Spring? (answer)
- 10 Best Spring Framework Courses for Beginners (online courses)
- What is the difference between Setter vs Constructor Injection in Spring? (answer)
- 5 Advanced Spring Books Java developer should read (books)
Thanks for reading this tip, if you like this article then please share it with your friends and colleagues. If you have any suggestions or feedback, feel free to drop a comment.
And, now quiz time? Who is the author of Spring Framework?
3 comments :
You could also install SDKMAN (http://sdkman.io). The jars are stored in the .sdkman/springboot/ directory.
If we really need to download jar manually (maven and gradle are of course always first pick) there is also a nice site which will allow us to download package with jar and all its any potentialy needed dependencies
https://jar-download.com
Getting 404 not found while accessing the mavin webiste for downloading spring framework jar files.
Post a Comment