Friday, January 3, 2025

Top 5 Online Courses to Learn Maven in 2025 - Best of Lot

The Apache Maven or commonly known as just "Maven," is an essential tool for Java Programmers. It allows you to build your project, manage dependencies, generate documentation, and a lot more. I can vouch for Maven's usefulness because I have come from the pre-Maven world of Software development, where you need to manage all the JAR files required by your project. It may seem easy to you that just download the JAR file but it's not so easy in practice.  For example, you added a new library in your project say Spring framework which also needs log4j but you thought log4j is already there so you didn't do anything, only to realize that your application is not starting anymore and throwing long and convoluted errors. 

Thursday, January 4, 2024

Why Java Developer Should Learn Maven or Gradle in 2024?

Hello guys, being a Java blogger, many Java developers ask me questions like "I am learning Java, should I also learn Maven or Gradle?" or "Is it mandatory to learn Maven to get a job as a Java developer", "Should I learn Maven or Gradle, which one is better for future?" and the less common one "Why should I learn Maven or Gradle as a Java developer?".  In the past, I have shared the best courses to learn Maven for Java developers and some useful Gradle books and courses,  as well as answered questions around Maven vs Gradle and I will try to answer these questions in this article and assert the importance of Maven and Gradle as a build tool for Java Developer.  Along the way, I will also share useful resources to learn both Maven and Gradle for Java developers. 

Tuesday, September 19, 2023

9 Maven Concepts and Tools Every Java Developers Should Know

The Apache Maven is an essential tool for Java developers. It makes their life easy by allowing them to create a Java project faster by using a standard directory structure. It also helps them to download project dependency automatically. Not only that, but Maven also downloads transitive dependencies that relieve Java developers from the big headache of keep check of different versions of dependent libraries. For example, if your application is dependent on the Spring framework, but Spring is dependent on Log4j then you also need to download the correct version of Log4j JAR files for the Spring MVC framework, Maven does this automatically for you.

Where and How to download Spring Framework JAR file (Spring 5.0 or Spring 4.0) without Maven, Gradle

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.

Wednesday, July 26, 2023

How to install Maven on Windows? Example

There is no difference in installing Maven on Windows7, Windows 8, Windows 8.1, or Windows 10, you can follow the same steps to install Maven in any version of the Windows operating system. Installing Maven is very easy, just download the Apache Maven ZIP file from the Apache Maven Project website (https://maven.apache.org/download.cgi). You can download the apache-maven-3.3.9-bin.zip for using Maven on your 64-bit Windows machine. Remember, Maven 3.3 requires JDK 1.7 or above to run, so make sure you already installed JDK 7 or JDK8. Once you download the binary distribution of Maven, half of the job is down.

Sunday, July 2, 2023

Maven JAR Artifiact Dependency Search Not Working in Eclipse - Solved

Recently I face a strange issue while using Maven in Eclipse via M2Eclipse plugin. I have created a Maven Java project in Eclipse and subsequently tried to add Spring framework as a dependency, to my surprise, nothing was happening. Eclipse was not able to search dependency in Maven central repository. I was surprised because I have never faced this issue while I was using the M2Eclipse plugin for a long time. After some trial and error, I realized that this is my brand new workspace and I am running with Eclipse Luna, the newest version of Eclipse which I had just downloaded a couple days of the back. My first hunch was that Eclipse might not able to connect to the Internet, and to verify that I tried connecting the Eclipse market place, and boom it was working fine.

Thursday, May 18, 2023

How to fix invalid target release: 1.7, 1.8, 1.9, or 1.10 Error in Maven Build? Solution

If you are building your Java project using Maven, maybe in Eclipse or from the command prompt by running mvn install and your build is failing with an error like "invalid target release: 1.7" or "invalid target release: 1.8" then you have come to the right place. In this article, I'll show you the reason why this error occurs and how you can deal with these errors even with higher Java versions like Java 9, 10 installed on your machine, or maybe with Java 11 in the coming month. The root cause of the problem is that you have specified a higher Java version in your pom.xml file for the Maven compiler plugin than what Maven knows in your system, and that's why it's saying invalid target release.

Thursday, April 27, 2023

3 Maven Eclipse Tips for Java Developers

Hello guys, If you are using Maven inside Eclipse IDE via M2Eclipse plugin then the following tips can help you a lot. Maven is one of the essential tool for Java developers as it is used to build your application, compile your code, create packages which can be deployed into physical box or cloud. Apart from that Maven also provide dependency management feature which means you don't need to manually download JAR file and add into your classpath. You just specify which library your code is using and the version and Maven will automatically download correct JAR file for you and put in your local Maven repository. Maven can also manage transitive dependency which means suppose your code is depend on Spring Framework which itself need 10 more open source library to work. With Maven you just need to specify which version f spring framework you want to use, and it will download all the library needed by Spring automatically.  In nutshell, Maven makes Java development easier and every Java developer should learn it. 

Wednesday, April 26, 2023

Top 21 Maven Interview Questions with Answers for Java Programmers

Hello guys, if you are preparing for Java developer interviews then you should not ignore Maven as its on of the important build tool for Java developers. Most of the Java projects you are going to work will use Maven for building artifacts and deploying into both Physical machine and cloud. If you already know the importance of Maven and looking for frequently asked Maven interview questions then you have come to the right place. Earlier, I have shared 130+ core Java questions, Spring Boot questions, Hibernate Questions, and even JUnit questions for thorough preparation and in this article, I am going to share 20 common Maven questions from Java interviews with answers. 

Maven vs Gradle? Which one Java Developer Should Learn?

Hello guys, if you are looking for a quick introduction to Maven and Gradle then you have come to the right place. Earlier, I have shared the best Maven course and best courses to learn Gradle, if you haven't checked them, I suggest you can also look at them if you want to learn these tools in depth. Maven and Gradle are the two most popular build tools for Java applications. They manage dependencies and create artifacts.  How do they do that? They have a repository like a maven has Maven repository where the store every single Java library and depending upon which library you add to your project, they download that library + all the transitive dependency for those libraries automatically. 

how to fix the password issue for Maven in Eclipse? [Solved]

Most Java programmers use Maven in Eclipse via the M2EClipse plug-in, which gives one capability to build, run, and test Java application using Maven. I also use the M2Eclipse plugin for integrating Maven with Eclipse, but more often there are issues dealing with them like Maven not able to find certain archetypes, or maven not able to download Jar files from remote maven repository. Since I need to change the password often for security reasons like every 3 months, I do see a lot of maven issues in Eclipse related to building projects. Most of the time these are compilation errors that are caused because maven is not able to connect to remote maven central repository, even though you have updated password in settings.xml in the maven installation folder like C:\apache-maven-2.2.1\conf\settings.xml

Thursday, August 4, 2022

How to fix "No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK" in Eclipse & Maven?

If you are like many Java developer who uses Maven and Eclipse to build Java project using M2Eclipse plugin, you might have seen this error before. I ran into it recently when I ran the Maven Install command for one of the Java projects, configured as Maven project,  only to realize that Maven builds failed after throwing this error. The main reason for this error is that Maven is not able to find javac (the Java compiler) which is required to compile Java source files. If you remember, the javac command comes in the bin directory of JDK, hence, you need a JDK installation in your local machine to compile the Java project.

Monday, September 13, 2021

What is difference between Maven, ANT, Jenkins and Hudson?

In short, though Maven and ANT are build tools the main difference is that maven also provides dependency management, standard project layout, and project management. On the difference between Maven, ANT, and Jenkins, later is a continuous integration tool which is much more than a build tool. You can set up your CI environment using Jenkins or Hudson and automatically build, test, and deploy your Java project. Now last, the main difference between Jenkins and Hudson, both originate from the same source code but one is a closed source while the other is open source. You can read the details in this article.

Thursday, August 19, 2021

Difference between mvn install, release and deploy commands in Maven - Examples

Even though there are a couple of powerful build and deployment tools that exist for Java applications like Gradle or ANT, It seems Maven is the king of them. I have used it in several Java projects over the years and it was initially ANT, but now they all use Maven with few Scala projects using Gradle. When you work with Maven you know that there are lots of commands to remember, especially if you are working on the command line. The thee Maven build commands which often confuses Java developers are mvn install, mvn release, and mvn deploy.

Thursday, August 5, 2021

How to increase java heap space on Maven and ANT - Example

Many times we get java.lang.OutOfMemoryError: Java heap space while building our project either by using maven or ANT just because heap size is not enough to build the project. At this point we just want to increase the heap size used by ANT or MAVEN and this java tip will let you do this:

Thursday, July 22, 2021

Top 10 Maven Plugins Every Java Developer Should Know

In the last couple of years, Maven has become the de-facto build tool for Java applications. Though there are challenges that exist from tools like Gradle, I think the dominance of Maven will help it to win the final battle. When I started with Maven, I was happy with just dependency management but then I come to know about maven plugins which let you customize your build-up to the level you can do with ANT. These plugins provide true power to Maven to automate most of the build-related tasks like compilation, testing, packaging, deployment, and even committing the source code into the remote source repository.