Posts

Showing posts with the label Maven

Where and How to download Spring Framework JAR file (Spring 4.0 or Spring 3.2) 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 it 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 specified version along with their dependencies. This greatly simplified the development and testing of Java application which uses a framework like Spring and Hibernate . Read more �

Difference between mvn install, release and deploy in Maven

Even though there are a couple of powerful build and deployment tools exists for Java applications e.g. Gradle or ANT, It seems Maven is the king of them. I have used 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 . Many Java developers are never sure which one put the artifact on the remote repository, local repository, and tag the source code in SCM like SVN. In this article, I'll explain the purpose of mvn install, mvn release, and mvn deploy command and some key difference between them. Read more �

3 Maven Eclipse Tips for Java Developers

If you are using Maven inside Eclipse IDE via M2Eclipse plugin then following tips can help you a lot. 1) Setup Dependency as Java Project in Eclipse If your POM dependencies is another project in Eclipse then your project will automatically get updated whenever you build the dependent project. For example, let's say you have a project, ABC, which is dependent on two core modules e.g. framework.jar and persistence.jar , if you have checked out these project and has set up them as Maven Eclipse project, M2Eclipse can directly add them as dependency, instead of loading their JAR files from repository, be it local or remote. Read more �

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 exists from tools like Gradle, but 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 task e.g. compilation, testing, packaging, deployment, and even committing the source code into the remote source repository. Many Java developers who use Maven daily are usually not aware of these essential Maven plugins mostly because Maven just works, or someone has already done the hard work for them. Read more �

How to install Maven on Windows 7,8 or 10?

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 Windows operating system. Installing Maven is very easy, just download the Apache Maven ZIP file from Apache Maven Project website ( https://maven.apache.org/download.cgi ). You can download the apache-maven-3.3.9-bin.zip for using Maven in 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. Now, you only need to extract the binary distribution and add the bin folder in PATH or add a couple of environment variable e.g. M2, M2_HOME into your Windows machine. Read more �

Maven Eclipse Error - "No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK"

Image
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 Maen 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 file. 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 Java project. You also need to have that configured in Eclipse as Installed JRE. Most likely, you have only installed and set up JRE and not JDK, at least that was the reason it throws "No compiler is provided in this environment" in my machine. Tools and Environment JDK 1.8 Eclipse Kepler M2Eclipse Apache Maven 3.0.3 I had a Java project configured as Maven project and th...